Share via


az postgres flexible-server

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage Azure Database for PostgreSQL Flexible Servers.

Commands

Name Description Type Status
az postgres flexible-server ad-admin

Manage server Active Directory administrators.

Core GA
az postgres flexible-server ad-admin create

Create an Active Directory administrator.

Core GA
az postgres flexible-server ad-admin delete

Delete an Active Directory administrator.

Core GA
az postgres flexible-server ad-admin list

List all Active Directory administrators.

Core GA
az postgres flexible-server ad-admin show

Get an Active Directory administrator.

Core GA
az postgres flexible-server ad-admin wait

Wait for an Active Directory administrator to satisfy certain conditions.

Core GA
az postgres flexible-server advanced-threat-protection-setting

Manage advanced threat protection setting for a PostgreSQL flexible server.

Core GA
az postgres flexible-server advanced-threat-protection-setting show

Get advanced threat protection settings for a PostgreSL flexible server.

Core GA
az postgres flexible-server advanced-threat-protection-setting update

Updates advanced threat protection setting state for a flexible server.

Core GA
az postgres flexible-server backup

Manage flexible server backups.

Core GA
az postgres flexible-server backup create

Create a new backup for a flexible server.

Core GA
az postgres flexible-server backup delete

Delete a specific backup.

Core GA
az postgres flexible-server backup list

List all the backups for a given server.

Core GA
az postgres flexible-server backup show

Show the details of a specific backup for a given server.

Core GA
az postgres flexible-server connect

Connect to a flexible server.

Extension GA
az postgres flexible-server create

Create a PostgreSQL flexible server.

Core GA
az postgres flexible-server db

Manage PostgreSQL databases on a flexible server.

Core GA
az postgres flexible-server db create

Create a PostgreSQL database on a flexible server.

Core GA
az postgres flexible-server db delete

Delete a database on a flexible server.

Core GA
az postgres flexible-server db list

List the databases for a flexible server.

Core GA
az postgres flexible-server db show

Show the details of a database.

Core GA
az postgres flexible-server delete

Delete a flexible server.

Core GA
az postgres flexible-server deploy

Enable and run GitHub Actions workflow for PostgreSQL server.

Core GA
az postgres flexible-server deploy run

Run an existing workflow in your github repository.

Core GA
az postgres flexible-server deploy setup

Create GitHub Actions workflow file for PostgreSQL server.

Core GA
az postgres flexible-server execute

Connect to a flexible server.

Extension GA
az postgres flexible-server firewall-rule

Manage firewall rules for a server.

Core GA
az postgres flexible-server firewall-rule create

Create a new firewall rule for a flexible server.

Core GA
az postgres flexible-server firewall-rule delete

Delete a firewall rule.

Core GA
az postgres flexible-server firewall-rule list

List all firewall rules for a flexible server.

Core GA
az postgres flexible-server firewall-rule show

Get the details of a firewall rule.

Core GA
az postgres flexible-server firewall-rule update

Update a firewall rule.

Core GA
az postgres flexible-server geo-restore

Geo-restore a flexible server from backup.

Core GA
az postgres flexible-server identity

Manage server user assigned identities.

Core GA
az postgres flexible-server identity assign

Add user asigned managed identities to the server.

Core GA
az postgres flexible-server identity list

List all user assigned managed identities from the server.

Core GA
az postgres flexible-server identity remove

Remove user asigned managed identites from the server.

Core GA
az postgres flexible-server identity show

Get an user assigned managed identity from the server.

Core GA
az postgres flexible-server list

List available flexible servers.

Core GA
az postgres flexible-server list-skus

Lists available sku's in the given region.

Core GA
az postgres flexible-server long-term-retention

Manage flexible server long-term-retention backups.

Core GA
az postgres flexible-server long-term-retention list

List all the long-term-retention backups for a given server.

Core GA
az postgres flexible-server long-term-retention pre-check

Performs all the checks that are needed for the subsequent long-term-retention backup operation to succeed.

Core GA
az postgres flexible-server long-term-retention show

Show the details of a specific long-term-retention backup for a given server.

Core GA
az postgres flexible-server long-term-retention start

Start long-term-retention backup for a flexible server. SAS URL parameter refers to the container SAS URL, inside the storage account, where the backups will be uploaded.

Core GA
az postgres flexible-server migration

Manage migration workflows for PostgreSQL Flexible Servers.

Core GA
az postgres flexible-server migration check-name-availability

Checks if the provided migration-name can be used.

Core GA
az postgres flexible-server migration create

Create a new migration workflow for a flexible server.

Core GA
az postgres flexible-server migration list

List the migrations of a flexible server.

Core GA
az postgres flexible-server migration show

Get the details of a specific migration.

Core GA
az postgres flexible-server migration update

Update a specific migration.

Core GA
az postgres flexible-server parameter

Commands for managing server parameter values for flexible server.

Core GA
az postgres flexible-server parameter list

List the parameter values for a flexible server.

Core GA
az postgres flexible-server parameter set

Update the parameter of a flexible server.

Core GA
az postgres flexible-server parameter show

Get the parameter for a flexible server.".

Core GA
az postgres flexible-server private-endpoint-connection

Manage PostgreSQL flexible server private endpoint connections.

Core GA
az postgres flexible-server private-endpoint-connection approve

Approve the specified private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection delete

Delete the specified private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection list

List all private endpoint connections associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection reject

Reject the specified private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection show

Show details of a private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-link-resource

Get Private link resource for a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-link-resource list

List private link resources associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-link-resource show

Get private link resource for a PostgreSQL flexible server.

Core GA
az postgres flexible-server replica

Manage read replicas.

Core GA
az postgres flexible-server replica create

Create a read replica for a server.

Core GA
az postgres flexible-server replica list

List all read replicas for a given server.

Core GA
az postgres flexible-server replica promote

Stop replication of a read replica and promote it to an independent server or as a primary server.

Core GA
az postgres flexible-server replica stop-replication

Stop replication to a read replica and make it a read/write server.

Core Deprecated
az postgres flexible-server restart

Restart a flexible server.

Core GA
az postgres flexible-server restore

Restore a flexible server from backup.

Core GA
az postgres flexible-server revive-dropped

Revive a dropped flexible server from backup.

Core GA
az postgres flexible-server server-logs

Manage server logs (log files) for a PostgreSQL flexible server.

Core GA
az postgres flexible-server server-logs download

Download log files for a PostgreSQL flexible server.

Core GA
az postgres flexible-server server-logs list

List log files for a PostgreSQL flexible server.

Core GA
az postgres flexible-server show

Get the details of a flexible server.

Core GA
az postgres flexible-server show-connection-string

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

Core GA
az postgres flexible-server start

Start a flexible server.

Core GA
az postgres flexible-server stop

Stop a flexible server.

Core GA
az postgres flexible-server update

Update a flexible server.

Core GA
az postgres flexible-server upgrade

Upgrade the major version of a flexible server.

Core GA
az postgres flexible-server virtual-endpoint

Manage virtual endpoints for a PostgreSQL flexible server.

Core GA
az postgres flexible-server virtual-endpoint create

Create a new virtual endpoint for a flexible server.

Core GA
az postgres flexible-server virtual-endpoint delete

Delete a virtual endpoint.

Core GA
az postgres flexible-server virtual-endpoint list

List all virtual endpoints for a flexible server.

Core GA
az postgres flexible-server virtual-endpoint show

Get the details of a virtual endpoint.

Core GA
az postgres flexible-server virtual-endpoint update

Update a virtual endpoint.

Core GA
az postgres flexible-server wait

Wait for the flexible server to satisfy certain conditions.

Core GA

az postgres flexible-server connect

Connect to a flexible server.

az postgres flexible-server connect --admin-user
                                    --name
                                    [--admin-password]
                                    [--database-name]
                                    [--interactive]
                                    [--querytext]

Required Parameters

--admin-user -u

The login username of the administrator.

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

Optional Parameters

--admin-password -p

The login password of the administrator.

--database-name -d

The name of a database.

--interactive

Pass this parameter to connect to database in interactive mode.

--querytext -q
Deprecated

Argument 'querytext' has been deprecated and will be removed in a future release. Use 'execute' instead.

A query to run against the flexible server.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server create

Create a PostgreSQL flexible server.

Create a PostgreSQL flexible server with custom or default configuration. For more information for network configuration, see

az postgres flexible-server create [--active-directory-auth {Disabled, Enabled}]
                                   [--address-prefixes]
                                   [--admin-password]
                                   [--admin-user]
                                   [--backup-identity]
                                   [--backup-key]
                                   [--backup-retention]
                                   [--create-default-database {Disabled, Enabled}]
                                   [--database-name]
                                   [--geo-redundant-backup {Disabled, Enabled}]
                                   [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                   [--identity]
                                   [--iops]
                                   [--key]
                                   [--location]
                                   [--name]
                                   [--password-auth {Disabled, Enabled}]
                                   [--performance-tier]
                                   [--private-dns-zone]
                                   [--public-access]
                                   [--resource-group]
                                   [--sku-name]
                                   [--standby-zone]
                                   [--storage-auto-grow {Disabled, Enabled}]
                                   [--storage-size]
                                   [--storage-type {PremiumV2_LRS, Premium_LRS}]
                                   [--subnet]
                                   [--subnet-prefixes]
                                   [--tags]
                                   [--throughput]
                                   [--tier]
                                   [--version]
                                   [--vnet]
                                   [--yes]
                                   [--zone]

Examples

Create a PostgreSQL flexible server with custom parameters

az postgres flexible-server create --location northeurope --resource-group testGroup \
  --name testserver --admin-user username --admin-password password \
  --sku-name Standard_D2s_v3 --tier GeneralPurpose --public-access 153.24.26.117 --storage-size 128 \
  --tags "key=value" --version 17 --high-availability ZoneRedundant --zone 1 \
  --standby-zone 3

Create a PostgreSQL flexible server using Premium SSD v2 Disks.

# set storage type to "PremiumV2_LRS" and provide values for Storage size (in GiB), IOPS (operations/sec), and Throughput (MB/sec).
az postgres flexible-server create --location northeurope --resource-group testGroup \
    --name testserver --admin-user username --admin-password password \
    --sku-name Standard_B1ms --tier Burstable --storage-type PremiumV2_LRS --storage-size 128 --iops 3000 --throughput 125

Create a PostgreSQL flexible server with default parameters and public access enabled by default. Resource group, server name, username, password, and default database will be created by CLI

az postgres flexible-server create

Create a PostgreSQL flexible server with public access and add the range of IP address to have access to this server. The --public-access parameter can be 'All', 'None', <startIpAddress>, or <startIpAddress>-<endIpAddress>

az postgres flexible-server create --resource-group testGroup --name testserver --public-access 125.23.54.31-125.23.54.35

Create a PostgreSQL flexible server with private access. If provided virtual network and subnet do not exists, virtual network and subnet with the specified address prefixes will be created.

az postgres flexible-server create --resource-group testGroup --name testserver --vnet myVnet --subnet mySubnet --address-prefixes 10.0.0.0/16 --subnet-prefixes 10.0.0.0/24

Create a PostgreSQL flexible server using a new subnet resource ID and new private DNS zone resource ID. The subnet and DNS zone can be created in different subscription or resource group.

az postgres flexible-server create \
  --resource-group testGroup --name testserver \
  --subnet /subscriptions/{SubID}/resourceGroups/{ResourceGroup}/providers/Microsoft.Network/virtualNetworks/{VNetName}/subnets/{SubnetName} \
  --private-dns-zone /subscriptions/{SubID}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/privateDnsZones/testPostgreSQLFlexibleDnsZone.private.postgres.database.azure.com \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24

Create a PostgreSQL flexible server using existing network resources in the same resource group. The provided subnet should not have any other resource deployed in it and this subnet will be delegated to Microsoft.DBforPostgreSQL/flexibleServers, if not already delegated. The private DNS zone will be linked to the virtual network if not already linked.

# create vnet
az network vnet create --resource-group testGroup --name testVnet --location testLocation --address-prefixes 172.0.0.0/16

# create subnet
az network vnet subnet create --resource-group testGroup --vnet-name testVnet --address-prefixes 172.0.0.0/24 --name testSubnet

# create private dns zone
az network private-dns zone create -g testGroup -n testDNS.private.postgres.database.azure.com

az postgres flexible-server create --resource-group testGroup \
  --name testserver --location testLocation \
  --subnet /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
  --private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com\


az postgres flexible-server create --resource-group testGroup --name testserver \
  --vnet testVnet --subnet testSubnet --location testLocation \
  --private-dns-zone /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com

Create a PostgreSQL flexible server using existing network resources in the different resource group / subscription.

az postgres flexible-server create --resource-group testGroup \
   --name testserver --location testLocation \
  --subnet /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/virtualNetworks/tesetVnet/subnets/testSubnet \
  --private-dns-zone /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com

Create a PostgreSQL flexible server with data encryption.

# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
  --vault-name testVault --query key.kid -o tsv)


# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
  --location testLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
  --key-permissions wrapKey unwrapKey get list


# create flexible server with data encryption enabled
az postgres flexible-server create -g testGroup -n testServer --location testLocation \
  --key $keyIdentifier --identity testIdentity

Create a PostgreSQL flexible server with active directory auth as well as password auth.

# create flexible server with aad auth and password auth enabled
az postgres flexible-server create -g testGroup -n testServer --location testLocation \
  --active-directory-auth Enabled

Create a PostgreSQL flexible server with active directory auth only.

# create flexible server with aad only auth and password auth disabled
az postgres flexible-server create -g testGroup -n testServer --location testLocation \
  --active-directory-auth Enabled --password-auth Disabled

Create a PostgreSQL flexible server with public access, geo-redundant backup enabled and add the range of IP address to have access to this server. The --public-access parameter can be 'All', 'None', <startIpAddress>, or <startIpAddress>-<endIpAddress>

az postgres flexible-server create --resource-group testGroup --name testserver --geo-redundant-backup Enabled --public-access 125.23.54.31-125.23.54.35

Create a PostgreSQL flexible server with data encryption for geo-rundundant backup enabled server.

# create keyvault
az keyvault create -g testGroup -n testVault --location testLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
keyIdentifier=$(az keyvault key create --name testKey -p software \
  --vault-name testVault --query key.kid -o tsv)


# create identity and save its principalId
identityPrincipalId=$(az identity create -g testGroup --name testIdentity \
  --location testLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n testVault --object-id $identityPrincipalId \
  --key-permissions wrapKey unwrapKey get list

# create keyvault in geo-paired region
az keyvault create -g testGroup -n geoVault --location geoPairedLocation \
  --enable-purge-protection true


# create key in keyvault and save its key identifier
geoKeyIdentifier=$(az keyvault key create --name geoKey -p software \
  --vault-name geoVault --query key.kid -o tsv)


# create identity in geo-raired location and save its principalId
geoIdentityPrincipalId=$(az identity create -g testGroup --name geoIdentity \
  --location geoPairedLocation --query principalId -o tsv)


# add testIdentity as an access policy with key permissions 'Wrap Key', 'Unwrap Key', 'Get' and 'List' inside testVault
az keyvault set-policy -g testGroup -n geoVault --object-id $geoIdentityPrincipalId \
  --key-permissions wrapKey unwrapKey get list


# create flexible server with data encryption enabled for geo-backup Enabled server
az postgres flexible-server create -g testGroup -n testServer --location testLocation --geo-redundant-backup Enabled \
  --key $keyIdentifier --identity testIdentity --backup-key $geoKeyIdentifier --backup-identity geoIdentity

Create flexible server with custom storage performance tier. Accepted values "P4", "P6", "P10", "P15", "P20", "P30", \ "P40", "P50", "P60", "P70", "P80". Actual allowed values depend on the --storage-size selection for flexible server creation. \ Default value for storage performance tier depends on the --storage-size selected for flexible server creation.

az postgres flexible-server create -g testGroup -n testServer --location testLocation --performance-tier P15

create flexible server with storage auto-grow as Enabled. Accepted values Enabled / Disabled. Default value for storage auto-grow is "Disabled".

az postgres flexible-server create -g testGroup -n testServer --location testLocation --storage-auto-grow Enabled

Optional Parameters

--active-directory-auth

Whether Azure Active Directory authentication is enabled.

Accepted values: Disabled, Enabled
Default value: Disabled
--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: morbidlard4
--backup-identity

The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.

--backup-key

The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.

--backup-retention

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

Default value: 7
--create-default-database -c

Enable or disable the creation of default database flexibleserverdb. Default value is Enabled.

Accepted values: Disabled, Enabled
Default value: Enabled
--database-name -d

The name of the database to be created when provisioning the database server.

--geo-redundant-backup

Whether or not geo redundant backup is enabled.

Accepted values: Disabled, Enabled
Default value: Disabled
--high-availability

Enable (ZoneRedundant or SameZone) or disable high availability feature.

Accepted values: Disabled, SameZone, ZoneRedundant
Default value: Disabled
--identity

The name or resource ID of the user assigned identity for data encryption.

--iops

Value of IOPS in (operations/sec) to be allocated for this server. This value can only be updated if flexible server is using Premium SSD v2 Disks.

--key

The resource ID of the primary keyvault key for data encryption.

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

--password-auth

Whether password authentication is enabled.

Accepted values: Disabled, Enabled
Default value: Enabled
--performance-tier

Performance tier of the server.

--private-dns-zone

This parameter only applies for a server with private access. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.

--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. Setting it to "None" 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_B1ms.

Default value: Standard_D2s_v3
--standby-zone

The availability zone information of the standby server when high availability is enabled.

--storage-auto-grow

Enable or disable autogrow of the storage. Default value is Enabled.

Accepted values: Disabled, Enabled
Default value: Disabled
--storage-size

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

Default value: 128
--storage-type

Storage type for the server. Allowed values are Premium_LRS and PremiumV2_LRS. Default value is Premium_LRS.Must set iops and throughput if using PremiumV2_LRS.

Accepted values: PremiumV2_LRS, Premium_LRS
--subnet

Name or resource ID of a new or existing subnet. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to 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 subnet in CIDR format. Default value is 10.0.0.0/24.

--tags

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

--throughput

Storage throughput in (MB/sec) for the server. This value can only be updated if flexible server is using Premium SSD v2 Disks.

--tier

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

Default value: GeneralPurpose
--version

Server major version.

Default value: 16
--vnet

Name or ID of a new or existing virtual network. If you want to use a vnet from different resource group or subscription, please provide a resource ID. 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.

--yes -y

Do not prompt for confirmation.

Default value: False
--zone -z

Availability zone into which to provision the resource.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server execute

Connect to a flexible server.

az postgres flexible-server execute --admin-password
                                    --admin-user
                                    --name
                                    [--database-name]
                                    [--file-path]
                                    [--querytext]

Required Parameters

--admin-password -p

The login password of the administrator.

--admin-user -u

The login username of the administrator.

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

Optional Parameters

--database-name -d

The name of a database.

--file-path -f

The path of the sql file to execute.

--querytext -q

A query to run against the flexible server.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server geo-restore

Geo-restore a flexible server from backup.

az postgres flexible-server geo-restore --location
                                        --source-server
                                        [--address-prefixes]
                                        [--backup-identity]
                                        [--backup-key]
                                        [--geo-redundant-backup {Disabled, Enabled}]
                                        [--identity]
                                        [--ids]
                                        [--key]
                                        [--name]
                                        [--no-wait]
                                        [--private-dns-zone]
                                        [--resource-group]
                                        [--subnet]
                                        [--subnet-prefixes]
                                        [--subscription]
                                        [--vnet]
                                        [--yes]
                                        [--zone]

Examples

Geo-restore public access server 'testserver' to a new server 'testserverNew' in location 'newLocation' with public access.

az postgres flexible-server geo-restore --resource-group testGroup --name testserverNew --source-server testserver --location newLocation

Geo-restore private access server 'testserver' as a new server 'testserverNew' with new subnet. New vnet, subnet, and private dns zone for the restored server will be provisioned. Please refer to 'flexible-server create' command for more private access scenarios.

az postgres flexible-server geo-restore --resource-group testGroup --name testserverNew \
  --source-server testserver --vnet newVnet --subnet newSubnet \
  --address-prefixes 172.0.0.0/16 --subnet-prefixes 172.0.0.0/24 \
  --private-dns-zone testDNS.postgres.database.azure.com --location newLocation

Geo-restore 'testserver' to current point-in-time as a new server 'testserverNew' in a different subscription / resource group. \ Here --resource-group is for the target server's resource group, and --source-server must be passed as resource ID. \ This resource ID can be in a subscription different than the subscription used for az account set.

az postgres flexible-server geo-restore --resource-group testGroup --name testserverNew --location newLocation \
  --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName}

Required Parameters

--location -l

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

--source-server

The name or resource ID of the source server to restore from.

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.

--backup-identity

The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.

--backup-key

The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.

--geo-redundant-backup

Whether or not geo redundant backup is enabled.

Accepted values: Disabled, Enabled
Default value: Disabled
--identity

The name or resource ID of the user assigned identity for data encryption.

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

--key

The resource ID of the primary keyvault key for data encryption.

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

--no-wait

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

Default value: False
--private-dns-zone

This parameter only applies for a server with private access. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.

--resource-group -g

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

--subnet

Name or resource ID of a new or existing subnet. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to 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 subnet 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.

--vnet

Name or ID of a new or existing virtual network. If you want to use a vnet from different resource group or subscription, please provide a resource ID. 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.

--yes -y

Do not prompt for confirmation.

Default value: False
--zone -z

Availability zone into which to provision the resource.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server list

List available flexible servers.

az postgres flexible-server list [--resource-group]

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

List all PostgreSQL flexible servers in a resource group in table format.

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

Optional Parameters

--resource-group -g

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server list-skus

Lists available sku's in the given region.

az postgres flexible-server list-skus --location

Required Parameters

--location -l

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server restart

Restart a flexible server.

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

Examples

Restart a flexible server.

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

Restart a server with planned failover

az postgres flexible-server restart --resource-group testGroup --name testserver --failover Planned

Restart a server with forced failover

az postgres flexible-server restart --resource-group testGroup --name testserver --failover Forced

Optional Parameters

--failover

Forced or planned failover for server restart operation. Allowed values: Forced, Planned.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server restore

Restore a flexible server from backup.

az postgres flexible-server restore --source-server
                                    [--address-prefixes]
                                    [--backup-identity]
                                    [--backup-key]
                                    [--geo-redundant-backup {Disabled, Enabled}]
                                    [--identity]
                                    [--ids]
                                    [--key]
                                    [--name]
                                    [--no-wait]
                                    [--private-dns-zone]
                                    [--resource-group]
                                    [--restore-time]
                                    [--storage-type {PremiumV2_LRS}]
                                    [--subnet]
                                    [--subnet-prefixes]
                                    [--subscription]
                                    [--vnet]
                                    [--yes]
                                    [--zone]

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 'testserver' to current point-in-time as a new server 'testserverNew'.

az postgres flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver

Restore 'testserver' to current point-in-time as a new server 'testserverNew' in a different resource group. \ Here --resource-group is for the target server's resource group, and --source-server must be passed as resource ID.

az postgres flexible-server restore --resource-group testGroup --name testserverNew \
  --source-server /subscriptions/{testSubscription}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName}

Restore 'testserver' to current point-in-time as a new server 'testserverNew' in a different subscription. \ Here --resource-group is for the target server's resource group, and --source-server must be passed as resource ID. \ This resource ID can be in a subscription different than the subscription used for az account set.

az postgres flexible-server restore --resource-group testGroup --name testserverNew \
  --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServerName}

Restore 'testserver' to current point-in-time as a new server 'testserverNew' using Premium SSD v2 Disks by setting storage type to "PremiumV2_LRS"

az postgres flexible-server restore --resource-group testGroup --name testserverNew --source-server testserver --storage-type PremiumV2_LRS

Required Parameters

--source-server

The name or resource ID of the source server to restore from.

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.

--backup-identity

The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.

--backup-key

The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.

--geo-redundant-backup

Whether or not geo redundant backup is enabled.

Accepted values: Disabled, Enabled
Default value: Disabled
--identity

The name or resource ID of the user assigned identity for data encryption.

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

--key

The resource ID of the primary keyvault key for data encryption.

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

--no-wait

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

Default value: False
--private-dns-zone

This parameter only applies for a server with private access. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.

--resource-group -g

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

--restore-time

The point in time in UTC to restore from (ISO8601 format), e.g., 2017-04-26T02:10:00+00:00The default value is set to current time.

Default value: 2024-12-25T11:13:05+00:00
--storage-type

Storage type for the new server. Allowed value is PremiumV2_LRS. Default value is none.

Accepted values: PremiumV2_LRS
--subnet

Name or resource ID of a new or existing subnet. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to 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 subnet 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.

--vnet

Name or ID of a new or existing virtual network. If you want to use a vnet from different resource group or subscription, please provide a resource ID. 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.

--yes -y

Do not prompt for confirmation.

Default value: False
--zone -z

Availability zone into which to provision the resource.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server revive-dropped

Revive a dropped flexible server from backup.

az postgres flexible-server revive-dropped --location
                                           --source-server
                                           [--address-prefixes]
                                           [--backup-identity]
                                           [--backup-key]
                                           [--geo-redundant-backup {Disabled, Enabled}]
                                           [--identity]
                                           [--ids]
                                           [--key]
                                           [--name]
                                           [--no-wait]
                                           [--private-dns-zone]
                                           [--resource-group]
                                           [--subnet]
                                           [--subnet-prefixes]
                                           [--subscription]
                                           [--vnet]
                                           [--yes]
                                           [--zone]

Examples

Revive dropped public access server 'testserver' to a new server 'testserverNew' in location 'newLocation' with public access.

az postgres flexible-server revive-dropped --resource-group testGroup --name testserverNew --source-server /subscriptions/{SubId}/resourceGroups/{testGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/testserver --location newLocation

Revive dropped public access server 'testserver' with data encryption enabled as a new server 'testserverNew' with data encryption.

az postgres flexible-server revive-dropped -l testLocation --resource-group testGroup --name testserverNew \
  --source-server testserver --key newKeyIdentifier --identity newIdentity

Required Parameters

--location -l

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

--source-server

The name or resource ID of the source server to restore from.

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.

--backup-identity

The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.

--backup-key

The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.

--geo-redundant-backup

Whether or not geo redundant backup is enabled.

Accepted values: Disabled, Enabled
Default value: Disabled
--identity

The name or resource ID of the user assigned identity for data encryption.

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

--key

The resource ID of the primary keyvault key for data encryption.

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

--no-wait

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

Default value: False
--private-dns-zone

This parameter only applies for a server with private access. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.

--resource-group -g

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

--subnet

Name or resource ID of a new or existing subnet. If you want to use a subnet from different resource group or subscription, please provide resource ID instead of name. Please note that the subnet will be delegated to 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 subnet 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.

--vnet

Name or ID of a new or existing virtual network. If you want to use a vnet from different resource group or subscription, please provide a resource ID. 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.

--yes -y

Do not prompt for confirmation.

Default value: False
--zone -z

Availability zone into which to provision the resource.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server show

Get the details of a flexible server.

az postgres flexible-server show [--ids]
                                 [--name]
                                 [--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.

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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]
                                                   [--pg-bouncer]
                                                   [--server-name]
                                                   [--subscription]

Examples

Show connection strings for cmd and programming languages.

az postgres flexible-server show-connection-string -s testserver -u username -p password -d databasename

Show connection strings for cmd and programming languages with PgBouncer enabled.

az postgres flexible-server show-connection-string -s testserver -u username -p password -d databasename --pg-bouncer

Optional Parameters

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

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

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

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

The name of the database to be created when provisioning the database server.

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.

--pg-bouncer

Show connection strings for PgBouncer.

Default value: False
--server-name -s

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

Default value: {server}
--subscription

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server start

Start a flexible server.

az postgres flexible-server start [--ids]
                                  [--name]
                                  [--no-wait]
                                  [--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.

--no-wait

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

Default value: False
--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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server stop

Stop a flexible server.

az postgres flexible-server stop [--ids]
                                 [--name]
                                 [--no-wait]
                                 [--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.

--no-wait

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

Default value: False
--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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server update

Update a flexible server.

az postgres flexible-server update [--active-directory-auth {Disabled, Enabled}]
                                   [--add]
                                   [--admin-password]
                                   [--backup-identity]
                                   [--backup-key]
                                   [--backup-retention]
                                   [--force-string]
                                   [--high-availability {Disabled, SameZone, ZoneRedundant}]
                                   [--identity]
                                   [--ids]
                                   [--iops]
                                   [--key]
                                   [--maintenance-window]
                                   [--name]
                                   [--password-auth {Disabled, Enabled}]
                                   [--performance-tier]
                                   [--private-dns-zone]
                                   [--public-access {Disabled, Enabled}]
                                   [--remove]
                                   [--resource-group]
                                   [--set]
                                   [--sku-name]
                                   [--standby-zone]
                                   [--storage-auto-grow {Disabled, Enabled}]
                                   [--storage-size]
                                   [--subscription]
                                   [--tags]
                                   [--throughput]
                                   [--tier]
                                   [--yes]

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

Update a flexible server to enable active directory auth for password auth enabled server

az postgres flexible-server update --resource-group testGroup --name testserver --active-directory-auth Enabled

Change key/identity for data encryption. Data encryption cannot be enabled post server creation, this will only update the key/identity.

# get key identifier of the existing key
newKeyIdentifier=$(az keyvault key show --vault-name testVault --name testKey \
  --query key.kid -o tsv)


# update server with new key/identity
az postgres flexible-server update --resource-group testGroup --name testserver \
  --key $newKeyIdentifier --identity newIdentity

Update a flexible server to update private DNS zone for a VNET enabled server, using private DNS zone in the same resource group and subscription. Private DNS zone will be created Private DNS zone will be linked to the VNET if not already linked.

az postgres flexible-server update --resource-group testGroup --name testserver --private-dns-zone testDNS2.postgres.database.azure.com

Update a flexible server to update private DNS zone for a VNET enabled server, using private DNS zone in the different resource group and subscription. Private DNS zone will be linked to the VNET if not already linked.

az postgres flexible-server update --resource-group testGroup --name testserver --private-dns-zone /subscriptions/{SubId2}/resourceGroups/{testGroup2}/providers/Microsoft.Network/privateDnsZones/testDNS.postgres.database.azure.com

Update a flexible server's storage to enable / disable storage auto-grow.

az postgres flexible-server update --resource-group testGroup --name testserver --storage-auto-grow Enabled

Update a flexible server's storage to set custom storage performance tier.

az postgres flexible-server update --resource-group testGroup --name testserver --performance-tier P15

Update a flexible server's storage to set IOPS (operations/sec). Server must be using Premium SSD v2 Disks.

az postgres flexible-server update --resource-group testGroup --name testserver --iops 3000

Update a flexible server's storage to set Throughput (MB/sec). Server must be using Premium SSD v2 Disks.

az postgres flexible-server update --resource-group testGroup --name testserver --throughput 125

Optional Parameters

--active-directory-auth

Whether Azure Active Directory authentication is enabled.

Accepted values: Disabled, Enabled
--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>.

Default value: []
--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-identity

The name or resource ID of the geo backup user identity for data encryption. The identity needs to be in the same region as the backup region.

--backup-key

The resource ID of the geo backup keyvault key for data encryption. The key needs to be in the same region as the backup region.

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

Default value: False
--high-availability

Enable (ZoneRedundant or SameZone) or disable high availability feature.

Accepted values: Disabled, SameZone, ZoneRedundant
--identity

The name or resource ID of the user assigned identity for data encryption.

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

--iops

Value of IOPS in (operations/sec) to be allocated for this server. This value can only be updated if flexible server is using Premium SSD v2 Disks.

--key

The resource ID of the primary keyvault key for data encryption.

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

--password-auth

Whether password authentication is enabled.

Accepted values: Disabled, Enabled
--performance-tier

Performance tier of the server.

--private-dns-zone

This parameter only applies for a server with private access. The name or id of new or existing private dns zone. You can use the private dns zone from same resource group, different resource group, or different subscription. If you want to use a zone from different resource group or subscription, please provide resource Id. CLI creates a new private dns zone within the same resource group as virtual network if not provided by users.

--public-access

Enable or disable the public access on a server.

Accepted values: Disabled, Enabled
--remove

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

Default value: []
--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=<value>.

Default value: []
--sku-name

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

--standby-zone

The availability zone information of the standby server when high availability is enabled.

--storage-auto-grow

Enable or disable autogrow of the storage. Default value is Enabled.

Accepted values: Disabled, Enabled
--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.

--throughput

Storage throughput in (MB/sec) for the server. This value can only be updated if flexible server is using Premium SSD v2 Disks.

--tier

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

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres flexible-server upgrade

Upgrade the major version of a flexible server.

az postgres flexible-server upgrade --version {12, 13, 14, 15, 16}
                                    [--ids]
                                    [--name]
                                    [--resource-group]
                                    [--subscription]
                                    [--yes]

Examples

Upgrade server 'testsvr' to PostgreSQL major version 16.

az postgres flexible-server upgrade -g testgroup -n testsvr -v 16

Required Parameters

--version -v

Server major version.

Accepted values: 12, 13, 14, 15, 16

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.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.

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

Default value: False
--custom

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

--deleted

Wait until deleted.

Default value: False
--exists

Wait until the resource exists.

Default value: False
--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'.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

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

--verbose

Increase logging verbosity. Use --debug for full debug logs.