Share via


az postgres flexible-server replica

Manage read replicas.

Commands

Name Description Type Status
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 replica create

Experimental Preview Deprecated

Create a read replica for a server.

az postgres flexible-server replica create --replica-name
                                           --resource-group
                                           --source-server
                                           [--address-prefixes]
                                           [--identity]
                                           [--key]
                                           [--location]
                                           [--no-wait]
                                           [--performance-tier]
                                           [--private-dns-zone]
                                           [--sku-name]
                                           [--storage-size]
                                           [--subnet]
                                           [--subnet-prefixes]
                                           [--tier]
                                           [--vnet]
                                           [--yes]
                                           [--zone]

Examples

Create a read replica 'testReplicaServer' for 'testserver' with public or private access in the specified zone and location if available.

az postgres flexible-server replica create --replica-name testReplicaServer -g testGroup --source-server testserver --zone 3 --location testLocation

Create a read replica 'testReplicaServer' with new subnet for 'testserver' with private access.

az postgres flexible-server replica create --replica-name testReplicaServer -g testGroup \
  --source-server testserver --zone 3 --location testLocation \
  --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

Create a read replica 'testReplicaServer' for 'testserver' with public or private access in the specified location if available. Since zone is not passed, it will automatically pick up zone in the replica location which is different from source server, if available, else will pick up zone same as source server in the replica location if available, else will set the zone as None, i.e. No preference

az postgres flexible-server replica create --replica-name testReplicaServer -g testGroup --source-server testserver --location testLocation

Create a read replica 'testReplicaServer' for 'testserver' with custom --storage-size and --sku.

az postgres flexible-server replica create --replica-name testReplicaServer -g testGroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256

Required Parameters

--replica-name
Experimental Preview Deprecated

The name of the server to restore to.

--resource-group -g
Experimental Preview Deprecated

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

--source-server
Experimental Preview Deprecated

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

Optional Parameters

--address-prefixes
Experimental Preview Deprecated

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

--identity
Experimental Preview Deprecated

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

--key
Experimental Preview Deprecated

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

--location -l
Experimental Preview Deprecated

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

--no-wait
Experimental Preview Deprecated

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

Default value: False
--performance-tier
Experimental Preview Deprecated

Performance tier of the server.

--private-dns-zone
Experimental Preview Deprecated

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.

--sku-name
Experimental Preview Deprecated

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

--storage-size
Experimental Preview Deprecated

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

--subnet
Experimental Preview Deprecated

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
Experimental Preview Deprecated

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

--tier
Experimental Preview Deprecated

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

--vnet
Experimental Preview Deprecated

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
Experimental Preview Deprecated

Do not prompt for confirmation.

Default value: False
--zone -z
Experimental Preview Deprecated

Availability zone into which to provision the resource.

Global Parameters
--debug
Experimental Preview Deprecated

Increase logging verbosity to show all debug logs.

--help -h
Experimental Preview Deprecated

Show this help message and exit.

--only-show-errors
Experimental Preview Deprecated

Only show errors, suppressing warnings.

--output -o
Experimental Preview Deprecated

Output format.

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

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

--subscription
Experimental Preview Deprecated

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

--verbose
Experimental Preview Deprecated

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

az postgres flexible-server replica list

Experimental Preview Deprecated

List all read replicas for a given server.

az postgres flexible-server replica list --name
                                         --resource-group

Examples

List all read replicas for master server 'testserver'.

az postgres flexible-server replica list -g testGroup -n testserver

Required Parameters

--name -n
Experimental Preview Deprecated

Name of the source server.

--resource-group -g
Experimental Preview Deprecated

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

Optional Parameters

Global Parameters
--debug
Experimental Preview Deprecated

Increase logging verbosity to show all debug logs.

--help -h
Experimental Preview Deprecated

Show this help message and exit.

--only-show-errors
Experimental Preview Deprecated

Only show errors, suppressing warnings.

--output -o
Experimental Preview Deprecated

Output format.

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

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

--subscription
Experimental Preview Deprecated

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

--verbose
Experimental Preview Deprecated

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

az postgres flexible-server replica promote

Experimental Preview Deprecated

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

az postgres flexible-server replica promote [--ids]
                                            [--name]
                                            [--promote-mode {standalone, switchover}]
                                            [--promote-option {forced, planned}]
                                            [--resource-group]
                                            [--subscription]
                                            [--yes]

Examples

Stop replication to 'testReplicaServer' and promote it a standalone read/write server.

az postgres flexible-server replica promote -g testGroup -n testReplicaServer

Stop replication to 'testReplicaServer' and promote it a standalone read/write server with forced data sync.

az postgres flexible-server replica promote -g testGroup -n testReplicaServer --promote-mode standalone --promote-option forced

Stop replication to 'testReplicaServer' and promote it to primary server with planned data sync. The replica you are promoting must have the reader virtual endpoint assigned, or you will receive an error on promotion.

az postgres flexible-server replica promote -g testGroup -n testReplicaServer --promote-mode switchover --promote-option planned

Required Parameters

Optional Parameters

--ids
Experimental Preview Deprecated

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
Experimental Preview Deprecated

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

--promote-mode
Experimental Preview Deprecated

Whether to promote read replica to an independent server or promite it as a primary server.

Accepted values: standalone, switchover
Default value: standalone
--promote-option
Experimental Preview Deprecated

Whether to sync data before promoting read replica or promote as soon as possible.

Accepted values: forced, planned
Default value: planned
--resource-group -g
Experimental Preview Deprecated

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

--subscription
Experimental Preview Deprecated

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

--yes -y
Experimental Preview Deprecated

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug
Experimental Preview Deprecated

Increase logging verbosity to show all debug logs.

--help -h
Experimental Preview Deprecated

Show this help message and exit.

--only-show-errors
Experimental Preview Deprecated

Only show errors, suppressing warnings.

--output -o
Experimental Preview Deprecated

Output format.

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

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

--subscription
Experimental Preview Deprecated

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

--verbose
Experimental Preview Deprecated

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

az postgres flexible-server replica stop-replication

Experimental Preview Deprecated

This command has been deprecated and will be removed in a future release. Use 'postgres flexible-server replica promote' instead.

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

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

Examples

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

az postgres flexible-server replica stop-replication -g testGroup -n testReplicaServer

Required Parameters

Optional Parameters

--ids
Experimental Preview Deprecated

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
Experimental Preview Deprecated

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
Experimental Preview Deprecated

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

--subscription
Experimental Preview Deprecated

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

--yes -y
Experimental Preview Deprecated

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug
Experimental Preview Deprecated

Increase logging verbosity to show all debug logs.

--help -h
Experimental Preview Deprecated

Show this help message and exit.

--only-show-errors
Experimental Preview Deprecated

Only show errors, suppressing warnings.

--output -o
Experimental Preview Deprecated

Output format.

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

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

--subscription
Experimental Preview Deprecated

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

--verbose
Experimental Preview Deprecated

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