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 to identify the right Azure resource) to describe the configuration information available for the selected database server:
az postgres server show
--name cc-project5-db-server
--resource-group cloud-shell-storage-westeurope
02 The command output should return the requested metadata. This information will be required for configuring the new PostgreSQL database server:
{
"earliestRestoreDate": "2020-03-28T11:00:00.597000+00:00",
"fullyQualifiedDomainName": "cc-project5-db-server.postgres.database.azure.com",,
"name": "cc-project5-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
},
"type": "Microsoft.DBforPostgreSQL/servers",
"userVisibleState": "Ready",
"version": "9.6"
}
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 with the latest major version of the PostgreSQL engine. To identify the latest major version supported by the Azure Database for PostgreSQL service, check this Azure documentation page:
az postgres server create
--name cc-project5-pg11-server
--resource-group cloud-shell-storage-westeurope
--sku-name GP_Gen5_2
--storage-size 20480
--location eastus
--version 11
--admin-user <cc-pg-admin-user>
--admin-password <cc-pg-admin-password>
04 The command output should return the metadata for the new Azure PostgreSQL database server:
{
"administratorLogin": "",
"earliestRestoreDate": "2020-03-29T11:49:11.340000+00:00",
"fullyQualifiedDomainName": "cc-project5-pg11-server.postgres.database.azure.com",
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.DBforPostgreSQL/servers/cc-project5-pg11-server",
"location": "eastus",
"masterServerId": "",
"name": "cc-project5-pg11-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": "11"
}
05 Once the new Azure PostgreSQL database server is successfully deployed, migrate your PostgreSQL database from the source server to the destination (new) server using the PostgreSQL dump and restore operations.
06 Now you can remove the source server in order to stop adding charges to your Microsoft Azure cloud 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:
az postgres server delete
--name cc-project5-db-server
--resource-group cloud-shell-storage-westeurope
07 The postgres server delete command request should ask for your confirmation. Press y to confirm:
Are you sure you want to perform this operation? (y/n):
08 Repeat steps no. 1 – 7 for each Azure PostgreSQL database server available in the current subscription.
09 Repeat steps no. 1 – 8 for each subscription created within your Microsoft Azure cloud account.