Major version upgrade of Azure Database for PostgreSQL - Flexible Server with Azure CLI

APPLIES TO: Azure Database for PostgreSQL - Flexible Server

This article provides step-by-step procedure to perform a major version upgrade in Azure Database for PostgreSQL flexible server using Azure CLI.

Prerequisites

  • If you don't have an Azure subscription, create a free account before you begin.

  • Install or upgrade Azure CLI to the latest version. See Install Azure CLI.

  • Log in to Azure account using az login command. Note the id property, which refers to Subscription ID for your Azure account.

    az login
    
  • If you have multiple subscriptions, choose the appropriate subscription in which you want to create the server using the az account set command.

    az account set --subscription <subscription id>
    
  • Create an Azure Database for PostgreSQL flexible server instance if you haven't already created one using the az postgres flexible-server create command.

    az postgres flexible-server create --resource-group myresourcegroup --name myservername
    

Perform Major Version Upgrade

You can run the following command to perform major version upgrade on an existing server.

Note

Major Version Upgrade action is irreversible. Please perform a point-in-time recovery (PITR) of your production server and test the upgrade in the non-production environment.

Upgrade the major version of a flexible server.

az postgres flexible-server upgrade --version {16, 15, 14, 13, 12}
                                    [--ids]
                                    [--name] [-n]
                                    [--resource-group] [-g]
                                    [--subscription]
                                    [--version] [-v]
                                    [--yes] [-y]
                                    

Example

Upgrade server 'testsvr' to PostgreSQL major version 16

az postgres flexible-server upgrade -g testgroup -n testsvr -v 16 -y

Next steps