01 Run postgres server show command (Windows/macOS/Linux) using the name of the Azure PostgreSQL server that you want to re-create as identifier parameter (see Audit section part II
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
az postgres server show
--name cc-postgres-db-server
--resource-group cloud-shell-storage-westeurope
02 The command output should return the requested metadata. This configuration information will be useful later when the new PostgreSQL database server will be created:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
{
"administratorLogin": "ccadminlogin",
"earliestRestoreDate": "2020-03-27T10:00:00.597000+00:00",
"fullyQualifiedDomainName": "cc-postgres-db-server.postgres.database.azure.com",,
"name": "cc-postgres-db-server",
"replicaCapacity": 5,
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"capacity": 2,
"family": "Gen5",
"name": "GP_Gen5_2",
"size": null,
"tier": "GeneralPurpose"
},
...
"sslEnforcement": "Enabled",
"storageProfile": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Disabled",
"storageAutogrow": "Enabled",
"storageMb": 20480
},
"tags": {},
"type": "Microsoft.DBforPostgreSQL/servers",
"userVisibleState": "Ready",
"version": "10"
}
03 Run postgres server create command (Windows/macOS/Linux) using the source server configuration information returned at the previous step as command parameter data, to create a new Azure PostgreSQL database server, configured to support geo-redundant backups:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
az postgres server create
--name cc-postgres-new-db-server
--resource-group cloud-shell-storage-westeurope
--sku-name GP_Gen5_2
--storage-size 20480
--geo-redundant-backup Enabled
--location eastus
--backup-retention 7
--admin-user <cc-admin-login-user>
--admin-password <cc-admin-password>
04 The command output should return the metadata for the new Azure PostgreSQL database server:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
{
"administratorLogin": "",
"earliestRestoreDate": "2020-03-28T11:41:33.340000+00:00",
"fullyQualifiedDomainName": "cc-postgres-new-db-server.postgres.database.azure.com",
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.DBforPostgreSQL/servers/cc-postgres-new-db-server",
"location": "eastus",
"masterServerId": "",
"name": "cc-postgres-new-db-server",
"replicaCapacity": 5,
"replicationRole": "None",
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"capacity": 2,
"family": "Gen5",
"name": "GP_Gen5_2",
"size": null,
"tier": "GeneralPurpose"
},
"sslEnforcement": "Enabled",
"storageProfile": {
"backupRetentionDays": 7,
"geoRedundantBackup": "Enabled",
"storageAutogrow": "Enabled",
"storageMb": 20480
},
"tags": null,
"type": "Microsoft.DBforPostgreSQL/servers",
"userVisibleState": "Ready",
"version": "10"
}
05 Once the new Azure PostgreSQL database server is available, you can remove the source server in order to stop adding charges to your Azure monthly bill. Run postgres server delete command (Windows/macOS/Linux) using the name of the source server that you want to delete (see Audit section part II to identify the right Azure resource), to remove the selected PostgreSQL resource from your Azure account:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
az postgres server delete
--name cc-postgres-db-server
--resource-group cloud-shell-storage-westeurope
06 The postgres server delete command request should ask for your confirmation. Press y to confirm:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
Are you sure you want to perform this operation? (y/n):
07 If required, repeat steps no. 1 – 6 for other PostgreSQL database servers deployed in the current subscription.
08 Repeat steps no. 1 – 7 for each subscription created within your Microsoft Azure cloud account.