Stop/Start Azure Database for PostgreSQL - Flexible Server using Azure CLI

APPLIES TO: Azure Database for PostgreSQL - Flexible Server

This article shows you how to perform restart, start and stop Azure Database for PostgreSQL flexible server using Azure CLI.

Prerequisites

  • If you don't have an Azure subscription, create a trial 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
    

Stop a running server

To stop a server, run az postgres flexible-server stop command. If you're using local context, you don't need to provide any arguments.

Usage:

az postgres flexible-server stop  [--name]
                               [--resource-group]
                               [--subscription]

Example without local context:

az postgres flexible-server stop  --resource-group resourcegroupname --name myservername

Example with local context:

az postgres flexible-server stop

Start a stopped server

To start a server, run az postgres flexible-server start command. If you're using local context, you don't need to provide any arguments.

Usage:

az postgres flexible-server start [--name]
                               [--resource-group]
                               [--subscription]

Example without local context:

az postgres flexible-server start  --resource-group --name myservername

Example with local context:

az postgres flexible-server start

Important

Once the server has restarted successfully, all management operations are now available for the Azure Database for PostgreSQL flexible server instance.

Next steps