CmdID / az / az postgres / az postgres flexible-server / az postgres flexible-server replica
az postgres flexible-server replica create
Create a read replica for a server. Azure CLI reference
5 examples Its page in the Azure CLI reference
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 testLocationIdentify-gName of resource group.--locationLocation.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"Identify-gName of resource group.--locationLocation.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 testLocationIdentify-gName of resource group.--locationLocation.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 256Identify-gName of resource group.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 testLocationIdentify-gName of resource group.--locationLocation.