az postgres

Manage Azure Database for PostgreSQL servers.

Commands

az postgres down

Delete the PostgreSQL server and its cached information.

az postgres show-connection-string

Show the connection strings for a PostgreSQL server database.

az postgres up

Set up an Azure Database for PostgreSQL server and configurations.

az postgres down

Delete the PostgreSQL server and its cached information.

az postgres down [--delete-group]
                 [--no-wait]
                 [--resource-group]
                 [--server-name]
                 [--yes]

Examples

Delete the server and the cached data, aside from the resource group.

az postgres down

Delete the resource group and the full cache.

az postgres down --delete-group

Optional Parameters

--delete-group

Delete the resource group.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--server-name -s

Name of the server.

--yes -y

Do not prompt for confirmation.

az postgres show-connection-string

Show the connection strings for a PostgreSQL server database.

az postgres show-connection-string [--admin-password]
                                   [--admin-user]
                                   [--database-name]
                                   [--server-name]

Optional Parameters

--admin-password -p

The login password of the administrator.

default value: {password}
--admin-user -u

The login username of the administrator.

default value: {login}
--database-name -d

The name of a database.

default value: {database}
--server-name -s

Name of the server.

default value: {server}

az postgres up

Set up an Azure Database for PostgreSQL server and configurations.

az postgres up [--admin-password]
               [--admin-user]
               [--backup-retention]
               [--database-name]
               [--generate-password]
               [--geo-redundant-backup {Disabled, Enabled}]
               [--location]
               [--resource-group]
               [--server-name]
               [--sku-name]
               [--ssl-enforcement {Disabled, Enabled}]
               [--storage-size]
               [--tags]
               [--version]

Examples

Ensure that a Azure Database for PostgreSQL server is up and running and configured for immediate use.

az postgres up

To override default names, provide parameters indicating desired values/existing resources.

az postgres up -g MyResourceGroup -s MyServer -d MyDatabase -u MyUsername -p MyPassword

Optional Parameters

--admin-password -p

The login password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.Your password cannot contain all or part of the login name. Part of a login name is defined as three or more consecutive alphanumeric characters.

--admin-user -u

The login username of the administrator.

--backup-retention

The number of days a backup is retained.

--database-name -d

The name of a database to initialize.

--generate-password

Generate a password.

--geo-redundant-backup

Enable Geo-redundant or not for server backup.

accepted values: Disabled, Enabled
default value: Disabled
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--server-name -s

Name of the server.

--sku-name

The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.

default value: GP_Gen5_2
--ssl-enforcement

Enable ssl enforcement or not when connect to server.

accepted values: Disabled, Enabled
default value: Enabled
--storage-size

The max storage size of the server. Unit is megabytes.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--version

Server version.

default value: 10