01 Run postgres server show command (Windows/macOS/Linux) using the name of the Azure PostgreSQL database server that you want to re-create as the identifier parameter, to describe the configuration information available for the selected server:
az postgres server show
--name "cc-project5-server"
--resource-group "cloud-shell-storage-westeurope"
02 The command output should return the requested configuration information. This information will be useful later when the new PostgreSQL database server will be created:
{
"administratorLogin": "ccadminlogin",
"earliestRestoreDate": "2022-07-20T10:00:00.597000+00:00",
"fullyQualifiedDomainName": "cc-project5-server.postgres.database.azure.com",
"name": "cc-project5-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": "11"
}
03 Run postgres server create command (Windows/macOS/Linux) using the source PostgreSQL server configuration information returned at the previous step as the command parameter data, to create a new Azure PostgreSQL database server, configured to support infrastructure double encryption:
az postgres server create
--name cc-postgres-encrypted-server
--resource-group cloud-shell-storage-westeurope
--sku-name GP_Gen5_2
--version 11
--storage-size 20480
--backup-retention 7
--location westeurope
--admin-user admin_username
--admin-password admin_password
--infrastructure-encryption Enabled
04 The command output should return the information available for the new PostgreSQL database server:
{
"administratorLogin": "admin_username",
"earliestRestoreDate": "2022-07-25T10:00:00.597000+00:00",
"fullyQualifiedDomainName": "cc-postgres-encrypted-server.postgres.database.azure.com",
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcd1234abcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.DBforPostgreSQL/servers/cc-postgres-encrypted-server",
"location": "westeurope",
"masterServerId": "",
"name": "cc-postgres-encrypted-server",
"replicaCapacity": 5,
"replicationRole": "None",
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"capacity": 2,
"family": "Gen5",
"name": "GP_Gen5_2",
"size": null,
"tier": "GeneralPurpose"
},
"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 provisioned, migrate your PostgreSQL database from the source server to the destination (new) server using the PostgreSQL dump and restore operations.
06 (Optional) You can remove the source server in order to stop adding charges to your Azure bill. Run postgres server delete command (Windows/macOS/Linux) using the name of the database server that you want to delete as the identifier parameter, to remove the selected PostgreSQL resource from your Azure account:
az postgres server delete
--name "cc-project5-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 PostgreSQL database server deployed in the current Azure subscription.
09 Repeat steps no. 1 – 8 for each subscription created within your Microsoft Azure cloud account.