az postgres flexible-server

Manage Azure Database for PostgreSQL Flexible Servers.

Commands

az postgres flexible-server create

Create a flexible server.

az postgres flexible-server delete

Delete a flexible server.

az postgres flexible-server firewall-rule

Manage firewall rules for a server.

az postgres flexible-server firewall-rule create

Create a new firewall rule for a flexible server.

az postgres flexible-server firewall-rule delete

Delete a firewall rule.

az postgres flexible-server firewall-rule list

List all firewall rules for a flexible server.

az postgres flexible-server firewall-rule show

Get the details of a firewall rule.

az postgres flexible-server firewall-rule update

Update a firewall rule.

az postgres flexible-server list

List available flexible servers.

az postgres flexible-server list-skus

Lists available sku's in the given region.

az postgres flexible-server parameter

Commands for managing server parameter values for flexible server.

az postgres flexible-server parameter list

List the parameter values for a flexible server.

az postgres flexible-server parameter set

Update the parameter of a flexible server.

az postgres flexible-server parameter show

Get the parameter for a flexible server.".

az postgres flexible-server restart

Restart a flexible server.

az postgres flexible-server restore

Restore a flexible server from backup.

az postgres flexible-server show

Get the details of a flexible server.

az postgres flexible-server show-connection-string

Show the connection strings for a PostgreSQL flexible-server database.

az postgres flexible-server start

Start a flexible server.

az postgres flexible-server stop

Stop a flexible server.

az postgres flexible-server update

Update a flexible server.

az postgres flexible-server wait

Wait for the flexible server to satisfy certain conditions.

az postgres flexible-server create

Create a flexible server.

az postgres flexible-server create [--address-prefixes]
                                   [--admin-password]
                                   [--admin-user,]
                                   [--assign-identity]
                                   [--backup-retention]
                                   [--high-availability]
                                   [--location]
                                   [--name]
                                   [--public-access]
                                   [--resource-group]
                                   [--sku-name]
                                   [--storage-size]
                                   [--subnet]
                                   [--subnet-prefixes]
                                   [--subscription]
                                   [--tags]
                                   [--tier]
                                   [--version]
                                   [--vnet]
                                   [--zone,]

Examples

Create a PostgreSQL flexible server with default params ( resource group, location, servername, username, password ) with VNET enabled by default.

az postgres flexible-server create

Create a PostgreSQL flexible server with default params ( resource group, location, servername, username, password ) with all public IPs(0.0.0.0 - 255.255.255.255).

az postgres flexible-server create --public-access all

Create a PostgreSQL flexible server with default params ( resource group, location, servername, username, password ) with public access without any firewall rules.

az postgres flexible-server create --public-access none

Create a PostgreSQL flexible server with specified SKU and storage, using defaults from local context.

az postgres flexible-server create --name testServer --admin-password password

Create a PostgreSQL flexible server with parameters set.

az postgres flexible-server create --location northeurope --resource-group testGroup --name testServer --admin-user username \
    --admin-password password --sku-name Standard_D4s_v3 --tier GeneralPurpose --public-access 0.0.0.0 \
    --storage-size 512 --tags "key=value" --version 12

Optional Parameters

--address-prefixes

The IP address prefix to use when creating a new virtual network in CIDR format. Default value is 10.0.0.0/16.

--admin-password -p

The 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.

--admin-user, -u

Administrator username for the server. Once set, it cannot be changed.

default value: seemlyRedwing8
--assign-identity

Generate and assign an Azure Active Directory Identity for this server for use with key management services like Azure KeyVault. No need to enter extra argument.

--backup-retention

The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.

default value: 7
--high-availability

Enable or disable high availability feature. Default value is Disabled.

default value: Disabled
--location -l

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

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--public-access

Determines the public access. Enter single or range of IP addresses to be included in the allowed list of IPs. IP address ranges must be dash-separated and not contain any spaces. Specifying 0.0.0.0 allows public access from any resources deployed within Azure to access your server. Specifying no IP address sets the server in public access mode but does not create a firewall rule.

--resource-group -g

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

--sku-name

The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_D4s_v3.

default value: Standard_D2s_v3
--storage-size

The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.

default value: 128
--subnet

Resource ID of an existing subnet. Please note that the subnet will be delegated to Microsoft.DBforPostgreSQL/flexibleServers/Microsoft.DBforMySQL/flexibleServers.After delegation, this subnet cannot be used for any other type of Azure resources.

--subnet-prefixes

The subnet IP address prefix to use when creating a new VNet in CIDR format. Default value is 10.0.0.0/24.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

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

--tier

Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized.

default value: GeneralPurpose
--version

Server major version.

default value: 12
--vnet

Name of an existing virtual network or name of a new one to create. The name must be between 2 to 64 characters. The name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens.

--zone, -z

Availability zone into which to provision the resource.

az postgres flexible-server delete

Delete a flexible server.

az postgres flexible-server delete [--ids]
                                   [--name]
                                   [--resource-group]
                                   [--subscription]
                                   [--yes]

Examples

Delete a flexible server.

az postgres flexible-server delete --resource-group testGroup --name testServer

Delete a flexible server without prompt or confirmation.

az postgres flexible-server delete --resource-group testGroup --name testServer --yes

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az postgres flexible-server list

List available flexible servers.

az postgres flexible-server list [--query-examples]
                                 [--resource-group]
                                 [--subscription]

Examples

List all PostgreSQL flexible servers in a subscription.

az postgres flexible-server list

List all PostgreSQL flexible servers in a resource group.

az postgres flexible-server list --resource-group testGroup

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server list-skus

Lists available sku's in the given region.

az postgres flexible-server list-skus --location
                                      [--subscription]

Required Parameters

--location -l

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

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server restart

Restart a flexible server.

az postgres flexible-server restart [--ids]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]

Examples

Restart a flexible server.

az postgres flexible-server restart --resource-group testGroup --name testServer

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server restore

Restore a flexible server from backup.

az postgres flexible-server restore --restore-time
                                    --source-server
                                    [--ids]
                                    [--location]
                                    [--name]
                                    [--no-wait]
                                    [--resource-group]
                                    [--subscription]

Examples

Restore 'testServer' to a specific point-in-time as a new server 'testServerNew'.

az postgres flexible-server restore --resource-group testGroup --name testServerNew --source-server testServer --restore-time "2017-06-15T13:10:00Z"

Restore 'testServer2' to 'testServerNew', where 'testServerNew' is in a different resource group from 'testServer2'.

az postgres flexible-server restore --resource-group testGroup --name testServerNew \
    --source-server "/subscriptions/${SubID}/resourceGroups/${ResourceGroup}/providers/Microsoft.DBforPostgreSQL/servers/testServer2" \
    --restore-time "2017-06-15T13:10:00Z"

Required Parameters

--restore-time

The point in time to restore from (ISO8601 format), e.g., 2017-04-26T02:10:00+08:00.

--source-server

The name of the source server to restore from.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--location -l

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

--name -n

The name of the new server that is created by the restore command.

--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>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server show

Get the details of a flexible server.

az postgres flexible-server show [--ids]
                                 [--name]
                                 [--query-examples]
                                 [--resource-group]
                                 [--subscription]

Examples

Get the details of a flexible server

az postgres flexible-server show --resource-group testGroup --name testServer

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server show-connection-string

Show the connection strings for a PostgreSQL flexible-server database.

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

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}
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--server-name -s

Name of the server.

default value: {server}
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server start

Start a flexible server.

az postgres flexible-server start [--ids]
                                  [--name]
                                  [--resource-group]
                                  [--subscription]

Examples

Start a flexible server.

az postgres flexible-server start --resource-group testGroup --name testServer

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server stop

Stop a flexible server.

az postgres flexible-server stop [--ids]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]

Examples

Stop a flexible server.

az postgres flexible-server stop --resource-group testGroup --name testServer

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az postgres flexible-server update

Update a flexible server.

az postgres flexible-server update [--add]
                                   [--admin-password]
                                   [--backup-retention]
                                   [--force-string]
                                   [--high-availability {Disabled, Enabled}]
                                   [--ids]
                                   [--maintenance-window]
                                   [--name]
                                   [--remove]
                                   [--resource-group]
                                   [--set]
                                   [--sku-name]
                                   [--storage-size]
                                   [--subscription]
                                   [--tags]
                                   [--tier]

Examples

Update a flexible server's sku, using local context for server and resource group.

az postgres flexible-server update --sku-name Standard_D4s_v3

Update a server's tags.

az postgres flexible-server update --resource-group testGroup --name testServer --tags "k1=v1" "k2=v2"

Reset password

az postgres flexible-server update --resource-group testGroup --name testServer -p password123

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--admin-password -p

The 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.

--backup-retention

The number of days a backup is retained. Range of 7 to 35 days. Default is 7 days.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--high-availability

Enable or disable high availability feature. Default value is Disabled.

accepted values: Disabled, Enabled
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--maintenance-window

Period of time (UTC) designated for maintenance. Examples: "Sun:23:30" to schedule on Sunday, 11:30pm UTC. To set back to default pass in "Disabled".

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

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

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--sku-name

The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_D4s_v3.

--storage-size

The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

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

--tier

Compute tier of the server. Accepted values: Burstable, GeneralPurpose, Memory Optimized.

az postgres flexible-server wait

Wait for the flexible server to satisfy certain conditions.

az postgres flexible-server wait [--created]
                                 [--custom]
                                 [--deleted]
                                 [--exists]
                                 [--ids]
                                 [--interval]
                                 [--name]
                                 [--resource-group]
                                 [--subscription]
                                 [--timeout]
                                 [--updated]

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--interval

Polling interval in seconds.

default value: 30
--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.