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 create
Create a read replica for a server.
az postgres flexible-server replica create --name
--resource-group
--source-server
[--acquire-policy-token]
[--change-reference]
[--identity]
[--key]
[--location]
[--no-wait]
[--performance-tier]
[--private-dns-zone]
[--sku-name]
[--storage-size]
[--storage-type {PremiumV2_LRS}]
[--subnet]
[--tags]
[--tier]
[--vnet]
[--yes]
[--zone]
Examples
Create a read replica 'testreplica' for 'testserver' with public or private access in the specified zone and location if available.
az postgres flexible-server replica create --name testreplica -g testGroup --source-server testserver --zone 3 --location testLocation
Create a read replica 'testreplica' for 'testserver' with private access using existing network resources.
az postgres flexible-server replica create --name testreplica -g testGroup \
--source-server testserver --zone 3 --location testLocation \
--vnet newVnet --subnet newSubnet \
--private-dns-zone testdns.postgres.database.azure.com \
--tags "key=value"
Create a read replica 'testreplica' 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 --name testreplica -g testgroup --source-server testserver --location testLocation
Create a read replica 'testreplica' for 'testserver' with custom --storage-size and --sku.
az postgres flexible-server replica create --name testreplica -g testgroup --source-server testserver --sku-name Standard_D4ds_v5 --storage-size 256
Create a read replica 'testreplica' for 'testserver', where 'testreplica' is in a different resource group 'newTestGroup'. Here --resource-group is for the read replica's resource group, and --source-server must be passed as resource identifier.
az postgres flexible-server replica create --name testreplicaserver -g newTestGroup --source-server /subscriptions/{sourceSubscriptionId}/resourceGroups/{sourceResourceGroup}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{sourceServer} --location testLocation
Required Parameters
Name of the read replica.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
The name or resource identifier of the source server to restore from.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Acquiring an Azure Policy token automatically for this resource operation.
| Property | Value |
|---|---|
| Parameter group: | Global Policy Arguments |
The related change reference ID for this resource operation.
| Property | Value |
|---|---|
| Parameter group: | Global Policy Arguments |
The name or resource identifier of the user assigned identity for data encryption.
The resource identifier of the primary keyvault key for data encryption.
Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.
Do not wait for the long-running operation to finish.
| Property | Value |
|---|---|
| Default value: | False |
Performance tier of the server.
This parameter only applies for a server with private access and is required when using --vnet or --subnet. The name or resource identifier of an existing private DNS zone. You can use a private DNS zone from the same resource group, a different resource group, or a different subscription. If you want to use a zone from a different resource group or subscription, please provide its resource identifier.
The name of the compute SKU. Follows the convention Standard_{VM name}. Examples: Standard_B1ms.
The storage capacity of the server. Minimum is 32 GiB and max is 16 TiB.
Storage type for the read replica. Allowed value is PremiumV2_LRS. Default is for the read replica to match storage type of the primary server.
| Property | Value |
|---|---|
| Accepted values: | PremiumV2_LRS |
Name or identifier of an existing subnet. If you want to use a subnet from a different resource group or subscription, please provide its resource identifier instead of name.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Compute tier of the server. Accepted values: Burstable, GeneralPurpose, MemoryOptimized.
Name or identifier of an existing virtual network. If you want to use a vnet from a different resource group or subscription, please provide a resource identifier. 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.
Do not prompt for confirmation.
| Property | Value |
|---|---|
| Default value: | False |
Availability zone into which to provision the resource.
Global Parameters
Increase logging verbosity to show all debug logs.
| Property | Value |
|---|---|
| Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
| Property | Value |
|---|---|
| Default value: | False |
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
| Property | Value |
|---|---|
| Default value: | False |
az postgres flexible-server replica list
List all read replicas for a given server.
az postgres flexible-server replica list [--ids]
[--name]
[--resource-group]
[--subscription]
Examples
List all read replicas for master server 'testserver'.
az postgres flexible-server replica list -g testgroup -n testserver
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
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.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Global Parameters
Increase logging verbosity to show all debug logs.
| Property | Value |
|---|---|
| Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
| Property | Value |
|---|---|
| Default value: | False |
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
| Property | Value |
|---|---|
| Default value: | False |
az postgres flexible-server replica promote
Stop replication of a read replica and promote it to an independent server or as a primary server.
az postgres flexible-server replica promote [--acquire-policy-token]
[--change-reference]
[--ids]
[--name]
[--promote-mode {standalone, switchover}]
[--promote-option {forced, planned}]
[--resource-group]
[--subscription]
[--yes]
Examples
Stop replication to 'testreplica' and promote it a standalone read/write server.
az postgres flexible-server replica promote -g testgroup -n testreplica
Stop replication to 'testreplica' and promote it a standalone read/write server with forced data sync.
az postgres flexible-server replica promote -g testgroup -n testreplica --promote-mode standalone --promote-option forced
Stop replication to 'testreplica' 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 testreplica --promote-mode switchover --promote-option planned
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Acquiring an Azure Policy token automatically for this resource operation.
| Property | Value |
|---|---|
| Parameter group: | Global Policy Arguments |
The related change reference ID for this resource operation.
| Property | Value |
|---|---|
| Parameter group: | Global Policy Arguments |
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.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Name of the read replica.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Whether to promote read replica to an independent server or promote it as a primary server.
| Property | Value |
|---|---|
| Default value: | standalone |
| Accepted values: | standalone, switchover |
Whether to sync data before promoting read replica or promote as soon as possible.
| Property | Value |
|---|---|
| Default value: | planned |
| Accepted values: | forced, planned |
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
| Property | Value |
|---|---|
| Parameter group: | Resource Id Arguments |
Do not prompt for confirmation.
| Property | Value |
|---|---|
| Default value: | False |
Global Parameters
Increase logging verbosity to show all debug logs.
| Property | Value |
|---|---|
| Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
| Property | Value |
|---|---|
| Default value: | False |
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
| Property | Value |
|---|---|
| Default value: | False |