# azure-arm-postgresql

> PostgreSQLManagementClient Library with typescript type definitions for node

Latest version **4.3.0** (published 2019-04-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install azure-arm-postgresql
pnpm add azure-arm-postgresql
yarn add azure-arm-postgresql
bun add azure-arm-postgresql
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2019-04-10 |
| First published | 2017-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 681.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 1174 |
| Author | Microsoft Corporation |
| Maintainers | windowsazure |
| Keywords | node, azure |

## Links

- npm: https://www.npmjs.com/package/azure-arm-postgresql
- Repository: https://github.com/azure/azure-sdk-for-node
- Homepage: https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/postgresqlManagement
- Issues: https://github.com/azure/azure-sdk-for-node/issues
- npm.io page: https://npm.io/package/azure-arm-postgresql

## Dependencies (2)

- [ms-rest](https://npm.io/package/ms-rest.md) ^2.5.0
- [ms-rest-azure](https://npm.io/package/ms-rest-azure.md) ^2.5.5

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 4.3.0 (latest) — 2019-04-10
- 4.2.0 — 2018-11-07
- 4.1.0 — 2018-07-12
- 4.0.0 — 2018-06-01
- 3.0.0-preview — 2018-03-29
- 2.0.0-preview — 2017-09-28

## README

# Microsoft Azure SDK for Node.js - PostgreSQL Management

This project provides a Node.js package that makes it easy to manage Microsoft
Azure PostgreSQL Resources. Right now it supports:
- **Node.js version: 6.x.x or higher**

## How to Install

```bash
npm install azure-arm-postgresql
```

## How to Use

### Listing servers

```javascript
const msRestAzure = require('ms-rest-azure');
const PostgreSQLManagementClient = require('azure-arm-postgresql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new PostgreSQLManagementClient(credentials, subscriptionID);
  return client.servers.listByResourceGroup(resourceGroup);
}).then((servers) => {
  console.log('List of servers:');
  console.dir(servers, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
```

### Creating a server

```javascript
const msRestAzure = require('ms-rest-azure');
const PostgreSQLManagementClient = require('azure-arm-postgresql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>'; // must be globally unique

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new PostgreSQLManagementClient(credentials, subscriptionID);
  return client.servers.createOrUpdate(resourceGroup, serverName, {
    location: 'eastus',
    properties: {
      createMode: 'Default',
      administratorLogin: 'postgres',
      administratorLoginPassword: 'F00Bar!!'
    }
  });
}).then((server) => {
  console.log('Server:');
  console.dir(server, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
```

### Listing databases

```javascript
const msRestAzure = require('ms-rest-azure');
const PostgreSQLManagementClient = require('azure-arm-postgresql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new PostgreSQLManagementClient(credentials, subscriptionID);
  return client.databases.listByServer(resourceGroup, serverName);
}).then((databases) => {
  console.log('List of databases:');
  console.dir(databases, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
```

### Creating a database

```javascript
const msRestAzure = require('ms-rest-azure');
const PostgreSQLManagementClient = require('azure-arm-postgresql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';
const databaseName = '<database name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new PostgreSQLManagementClient(credentials, subscriptionID);
  return client.databases.createOrUpdate(resourceGroup, serverName, databaseName, {});
}).then((database) => {
  console.log('Database:');
  console.dir(database, {depth: null, colors: true});
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
```

### Deleting a database

```javascript
const msRestAzure = require('ms-rest-azure');
const PostgreSQLManagementClient = require('azure-arm-postgresql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';
const databaseName = '<database name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new PostgreSQLManagementClient(credentials, subscriptionID);
  return client.databases.deleteMethod(resourceGroup, serverName, databaseName);
}).then(() => {
  console.log('Database deleted');
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
```

### Deleting a server

```javascript
const msRestAzure = require('ms-rest-azure');
const PostgreSQLManagementClient = require('azure-arm-postgresql');

const subscriptionID = '<subscription id>';
const resourceGroup = '<resource group name>';
const serverName = '<server name>';

msRestAzure.interactiveLogin().then((credentials) => {
  let client = new PostgreSQLManagementClient(credentials, subscriptionID);
  return client.servers.deleteMethod(resourceGroup, serverName);
}).then(() => {
  console.log('Server deleted');
}).catch((err) => {
  console.log('An error ocurred');
  console.dir(err, {depth: null, colors: true});
});
```

## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-node%2Flib%2Fservices%2FpostgresqlManagement%2FREADME.png)

---
_Source: https://npm.io/package/azure-arm-postgresql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
