Customize server parameters for Azure Database for PostgreSQL - Flexible Server using Azure CLI

APPLIES TO: Azure Database for PostgreSQL - Flexible Server

You can list, show, and update configuration parameters for an Azure PostgreSQL server using the Command Line Interface (Azure CLI). A subset of engine parameters is exposed at server-level and can be modified.

Prerequisites

To step through this how-to guide, you need:

List server parameters for an Azure Database for PostgreSQL flexible server instance

To list all modifiable parameters in a server and their values, run the az postgres flexible-server parameter list command.

You can list the server parameters for the server mydemoserver.postgres.database.azure.com under resource group myresourcegroup.

az postgres flexible-server parameter list --resource-group myresourcegroup --server-name mydemoserver

Show server parameter details

To show details about a particular parameter for a server, run the az postgres flexible-server parameter show command.

This example shows details of the log_min_messages server parameter for server mydemoserver.postgres.database.azure.com under resource group myresourcegroup.

az postgres flexible-server parameter show --name log_min_messages --resource-group myresourcegroup --server-name mydemoserver

Modify server parameter value

You can also modify the value of a certain server parameter, which updates the underlying configuration value for the Azure Database for PostgreSQL flexible server engine. To update the parameter, use the az postgres flexible-server parameter set command.

To update the log_min_messages server parameter of server mydemoserver.postgres.database.azure.com under resource group myresourcegroup.

az postgres flexible-server parameter set --name log_min_messages --value INFO --resource-group myresourcegroup --server-name mydemoserver

If you want to reset the value of a parameter, you simply choose to leave out the optional --value parameter, and the service applies the default value. In above example, it would look like:

az postgres flexible-server parameter set --name log_min_messages --resource-group myresourcegroup --server-name mydemoserver

This command resets the log_min_messages parameter to the default value WARNING. For more information on server parameters and permissible values, see PostgreSQL documentation on Setting Parameters.

Next steps