次の方法で共有


Customize server configuration parameters for Azure Database for PostgreSQL - Single Server using Azure CLI

APPLIES TO: Azure Database for PostgreSQL - Single Server

Important

Azure Database for PostgreSQL - Single Server is on the retirement path. We strongly recommend that you upgrade to Azure Database for PostgreSQL - Flexible Server. For more information about migrating to Azure Database for PostgreSQL - Flexible Server, see What's happening to Azure Database for PostgreSQL Single 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 configurations is exposed at server-level and can be modified.

Prerequisites

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

List server configuration parameters for Azure Database for PostgreSQL server

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

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

az postgres server configuration list --resource-group myresourcegroup --server mydemoserver

Show server configuration parameter details

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

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

az postgres server configuration show --name log_min_messages --resource-group myresourcegroup --server mydemoserver

Modify server configuration parameter value

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

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

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

If you want to reset the value of a configuration 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 server configuration set --name log_min_messages --resource-group myresourcegroup --server mydemoserver

This command resets the log_min_messages configuration to the default value WARNING. For more information on server configuration and permissible values, see PostgreSQL documentation on Server Configuration.

Next steps