Share via


az postgres

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage Azure Database for PostgreSQL servers.

Commands

Name Description Type Status
az postgres db

Manage PostgreSQL databases on a server.

Core GA
az postgres db create

Create a PostgreSQL database.

Core GA
az postgres db delete

Delete a database.

Core GA
az postgres db list

List the databases for a server.

Core GA
az postgres db show

Show the details of a database.

Core GA
az postgres down

Delete the PostgreSQL server and its cached information.

Extension GA
az postgres flexible-server

Manage Azure Database for PostgreSQL Flexible Servers.

Core and Extension GA
az postgres flexible-server ad-admin

Manage server Active Directory administrators.

Core GA
az postgres flexible-server ad-admin create

Create an Active Directory administrator.

Core GA
az postgres flexible-server ad-admin delete

Delete an Active Directory administrator.

Core GA
az postgres flexible-server ad-admin list

List all Active Directory administrators.

Core GA
az postgres flexible-server ad-admin show

Get an Active Directory administrator.

Core GA
az postgres flexible-server ad-admin wait

Wait for an Active Directory administrator to satisfy certain conditions.

Core GA
az postgres flexible-server advanced-threat-protection-setting

Manage advanced threat protection setting for a PostgreSQL flexible server.

Core GA
az postgres flexible-server advanced-threat-protection-setting show

Get advanced threat protection settings for a PostgreSL flexible server.

Core GA
az postgres flexible-server advanced-threat-protection-setting update

Updates advanced threat protection setting state for a flexible server.

Core GA
az postgres flexible-server backup

Manage flexible server backups.

Core GA
az postgres flexible-server backup list

List all the backups for a given server.

Core GA
az postgres flexible-server backup show

Show the details of a specific backup for a given server.

Core GA
az postgres flexible-server connect

Connect to a flexible server.

Extension GA
az postgres flexible-server create

Create a PostgreSQL flexible server.

Core GA
az postgres flexible-server db

Manage PostgreSQL databases on a flexible server.

Core GA
az postgres flexible-server db create

Create a PostgreSQL database on a flexible server.

Core GA
az postgres flexible-server db delete

Delete a database on a flexible server.

Core GA
az postgres flexible-server db list

List the databases for a flexible server.

Core GA
az postgres flexible-server db show

Show the details of a database.

Core GA
az postgres flexible-server delete

Delete a flexible server.

Core GA
az postgres flexible-server deploy

Enable and run GitHub Actions workflow for PostgreSQL server.

Core GA
az postgres flexible-server deploy run

Run an existing workflow in your github repository.

Core GA
az postgres flexible-server deploy setup

Create GitHub Actions workflow file for PostgreSQL server.

Core GA
az postgres flexible-server execute

Connect to a flexible server.

Extension GA
az postgres flexible-server firewall-rule

Manage firewall rules for a server.

Core GA
az postgres flexible-server firewall-rule create

Create a new firewall rule for a flexible server.

Core GA
az postgres flexible-server firewall-rule delete

Delete a firewall rule.

Core GA
az postgres flexible-server firewall-rule list

List all firewall rules for a flexible server.

Core GA
az postgres flexible-server firewall-rule show

Get the details of a firewall rule.

Core GA
az postgres flexible-server firewall-rule update

Update a firewall rule.

Core GA
az postgres flexible-server geo-restore

Geo-restore a flexible server from backup.

Core GA
az postgres flexible-server identity

Manage server user assigned identities.

Core GA
az postgres flexible-server identity assign

Add user asigned managed identities to the server.

Core GA
az postgres flexible-server identity list

List all user assigned managed identities from the server.

Core GA
az postgres flexible-server identity remove

Remove user asigned managed identites from the server.

Core GA
az postgres flexible-server identity show

Get an user assigned managed identity from the server.

Core GA
az postgres flexible-server list

List available flexible servers.

Core GA
az postgres flexible-server list-skus

Lists available sku's in the given region.

Core GA
az postgres flexible-server migration

Manage migration workflows for PostgreSQL Flexible Servers.

Core GA
az postgres flexible-server migration check-name-availability

Checks if the provided migration-name can be used.

Core GA
az postgres flexible-server migration create

Create a new migration workflow for a flexible server.

Core GA
az postgres flexible-server migration list

List the migrations of a flexible server.

Core GA
az postgres flexible-server migration show

Get the details of a specific migration.

Core GA
az postgres flexible-server migration update

Update a specific migration.

Core GA
az postgres flexible-server parameter

Commands for managing server parameter values for flexible server.

Core GA
az postgres flexible-server parameter list

List the parameter values for a flexible server.

Core GA
az postgres flexible-server parameter set

Update the parameter of a flexible server.

Core GA
az postgres flexible-server parameter show

Get the parameter for a flexible server.".

Core GA
az postgres flexible-server private-endpoint-connection

Manage PostgreSQL flexible server private endpoint connections.

Core GA
az postgres flexible-server private-endpoint-connection approve

Approve the specified private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection delete

Delete the specified private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection list

List all private endpoint connections associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection reject

Reject the specified private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-endpoint-connection show

Show details of a private endpoint connection associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-link-resource

Get Private link resource for a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-link-resource list

List private link resources associated with a PostgreSQL flexible server.

Core GA
az postgres flexible-server private-link-resource show

Get private link resource for a PostgreSQL flexible server.

Core GA
az postgres flexible-server replica

Manage read replicas.

Core GA
az postgres flexible-server replica create

Create a read replica for a server.

Core GA
az postgres flexible-server replica list

List all read replicas for a given server.

Core GA
az postgres flexible-server replica promote

Stop replication of a read replica and promote it to an independent server or as a primary server.

Core GA
az postgres flexible-server replica stop-replication

Stop replication to a read replica and make it a read/write server.

Core Deprecated
az postgres flexible-server restart

Restart a flexible server.

Core GA
az postgres flexible-server restore

Restore a flexible server from backup.

Core GA
az postgres flexible-server revive-dropped

Revive a dropped flexible server from backup.

Core GA
az postgres flexible-server server-logs

Manage server logs (log files) for a PostgreSQL flexible server.

Core GA
az postgres flexible-server server-logs download

Download log files for a PostgreSQL flexible server.

Core GA
az postgres flexible-server server-logs list

List log files for a PostgreSQL flexible server.

Core GA
az postgres flexible-server show

Get the details of a flexible server.

Core GA
az postgres flexible-server show-connection-string

Show the connection strings for a PostgreSQL flexible-server database.

Core GA
az postgres flexible-server start

Start a flexible server.

Core GA
az postgres flexible-server stop

Stop a flexible server.

Core GA
az postgres flexible-server update

Update a flexible server.

Core GA
az postgres flexible-server upgrade

Upgrade the major version of a flexible server.

Core GA
az postgres flexible-server virtual-endpoint

Manage virtual endpoints for a PostgreSQL flexible server.

Core GA
az postgres flexible-server virtual-endpoint create

Create a new virtual endpoint for a flexible server.

Core GA
az postgres flexible-server virtual-endpoint delete

Delete a virtual endpoint.

Core GA
az postgres flexible-server virtual-endpoint list

List all virtual endpoints for a flexible server.

Core GA
az postgres flexible-server virtual-endpoint show

Get the details of a virtual endpoint.

Core GA
az postgres flexible-server virtual-endpoint update

Update a virtual endpoint.

Core GA
az postgres flexible-server wait

Wait for the flexible server to satisfy certain conditions.

Core GA
az postgres server

Manage PostgreSQL servers.

Core GA
az postgres server-arc

Manage Azure Arc enabled PostgreSQL servers.

Extension Preview
az postgres server-arc create

Create an Azure Arc enabled PostgreSQL server.

Extension Preview
az postgres server-arc delete

Delete an Azure Arc enabled PostgreSQL server.

Extension Preview
az postgres server-arc endpoint

Manage Azure Arc enabled PostgreSQL server endpoints.

Extension Preview
az postgres server-arc endpoint list

List Azure Arc enabled PostgreSQL server endpoints.

Extension Preview
az postgres server-arc list

List Azure Arc enabled PostgreSQL server.

Extension Preview
az postgres server-arc restore

Restore an Azure Arc enabled PostgreSQL server from backup from another server.

Extension Preview
az postgres server-arc show

Show the details of an Azure Arc enabled PostgreSQL server.

Extension Preview
az postgres server-arc update

Update the configuration of an Azure Arc enabled PostgreSQL server.

Extension Preview
az postgres server-logs

Manage server logs.

Core GA
az postgres server-logs download

Download log files.

Core GA
az postgres server-logs list

List log files for a server.

Core GA
az postgres server ad-admin

Manage a postgres server's Active Directory administrator.

Core GA
az postgres server ad-admin create

Create an Active Directory Administrator for PostgreSQL server.

Core GA
az postgres server ad-admin delete

Delete an Active Directory Administrator for PostgreSQL server.

Core GA
az postgres server ad-admin list

List all Active Directory Administrators for PostgreSQL server.

Core GA
az postgres server ad-admin show

Get Active Directory Administrator information for a PostgreSQL server.

Core GA
az postgres server ad-admin wait

Place the CLI in a waiting state until a condition of the PostgreSQL server Active Directory Administrator is met.

Core GA
az postgres server configuration

Manage configuration values for a server.

Core GA
az postgres server configuration list

List the configuration values for a server.

Core GA
az postgres server configuration set

Update the configuration of a server.

Core GA
az postgres server configuration show

Get the configuration for a server.".

Core GA
az postgres server create

Create a server.

Core GA
az postgres server delete

Delete a server.

Core GA
az postgres server firewall-rule

Manage firewall rules for a server.

Core GA
az postgres server firewall-rule create

Create a new firewall rule for a server.

Core GA
az postgres server firewall-rule delete

Delete a firewall rule.

Core GA
az postgres server firewall-rule list

List all firewall rules for a server.

Core GA
az postgres server firewall-rule show

Get the details of a firewall rule.

Core GA
az postgres server firewall-rule update

Update a firewall rule.

Core GA
az postgres server georestore

Geo-restore a server from backup.

Core GA
az postgres server key

Manage PostgreSQL server keys.

Core GA
az postgres server key create

Create server key.

Core GA
az postgres server key delete

Delete server key.

Core GA
az postgres server key list

Gets a list of Server keys.

Core GA
az postgres server key show

Show server key.

Core GA
az postgres server list

List available servers.

Core GA
az postgres server list-skus

List available sku's in the given region.

Core GA
az postgres server private-endpoint-connection

Manage PostgreSQL server private endpoint connections.

Core GA
az postgres server private-endpoint-connection approve

Approve the specified private endpoint connection associated with a PostgreSQL server.

Core GA
az postgres server private-endpoint-connection delete

Delete the specified private endpoint connection associated with a PostgreSQL server.

Core GA
az postgres server private-endpoint-connection reject

Reject the specified private endpoint connection associated with a PostgreSQL server.

Core GA
az postgres server private-endpoint-connection show

Show details of a private endpoint connection associated with a PostgreSQL server.

Core GA
az postgres server private-link-resource

Manage PostgreSQL server private link resources.

Core GA
az postgres server private-link-resource list

List the private link resources supported for a PostgreSQL server.

Core GA
az postgres server replica

Manage read replicas.

Core GA
az postgres server replica create

Create a read replica for a server.

Core GA
az postgres server replica list

List all read replicas for a given server.

Core GA
az postgres server replica stop

Stop replication to a read replica and make it a read/write server.

Core GA
az postgres server restart

Restart a server.

Core GA
az postgres server restore

Restore a server from backup.

Core GA
az postgres server show

Get the details of a server.

Core GA
az postgres server show-connection-string

Show the connection strings for a PostgreSQL server database.

Core GA
az postgres server update

Update a server.

Core GA
az postgres server vnet-rule

Manage a server's virtual network rules.

Core GA
az postgres server vnet-rule create

Create a virtual network rule to allows access to a PostgreSQL server.

Core GA
az postgres server vnet-rule delete

Deletes the virtual network rule with the given name.

Core GA
az postgres server vnet-rule list

Gets a list of virtual network rules in a server.

Core GA
az postgres server vnet-rule show

Gets a virtual network rule.

Core GA
az postgres server vnet-rule update

Update a virtual network rule.

Core GA
az postgres server wait

Wait for server to satisfy certain conditions.

Core GA
az postgres show-connection-string

Show the connection strings for a PostgreSQL server database.

Extension GA
az postgres up

Set up an Azure Database for PostgreSQL server and configurations.

Extension GA

az postgres down

Delete the PostgreSQL server and its cached information.

az postgres down [--delete-group]
                 [--ids]
                 [--no-wait]
                 [--resource-group]
                 [--server-name]
                 [--subscription]
                 [--yes]

Examples

Delete the server and the cached data, aside from the resource group.

az postgres down

Delete the resource group and the full cache.

az postgres down --delete-group

Optional Parameters

--delete-group

Delete the resource group.

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--no-wait

Do not wait for the long-running operation to finish.

Default value: False
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--server-name -s

Name of the server.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres show-connection-string

Show the connection strings for a PostgreSQL server database.

az postgres show-connection-string [--admin-password]
                                   [--admin-user]
                                   [--database-name]
                                   [--ids]
                                   [--server-name]
                                   [--subscription]

Optional Parameters

--admin-password -p

The login password of the administrator.

Default value: {password}
--admin-user -u

The login username of the administrator.

Default value: {login}
--database-name -d

The name of a database.

Default value: {database}
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--server-name -s

Name of the server.

Default value: {server}
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres up

Set up an Azure Database for PostgreSQL server and configurations.

az postgres up [--admin-password]
               [--admin-user]
               [--backup-retention]
               [--database-name]
               [--generate-password]
               [--geo-redundant-backup {Disabled, Enabled}]
               [--ids]
               [--location]
               [--resource-group]
               [--server-name]
               [--sku-name]
               [--ssl-enforcement {Disabled, Enabled}]
               [--storage-size]
               [--subscription]
               [--tags]
               [--version]

Examples

Ensure that a Azure Database for PostgreSQL server is up and running and configured for immediate use.

az postgres up

To override default names, provide parameters indicating desired values/existing resources.

az postgres up -g MyResourceGroup -s MyServer -d MyDatabase -u MyUsername -p MyPassword

Optional Parameters

--admin-password -p

The login password of the administrator. Minimum 8 characters and maximum 128 characters. Password must contain characters from three of the following categories: English uppercase letters, English lowercase letters, numbers, and non-alphanumeric characters.Your password cannot contain all or part of the login name. Part of a login name is defined as three or more consecutive alphanumeric characters.

--admin-user -u

The login username of the administrator.

--backup-retention

The number of days a backup is retained.

--database-name -d

The name of a database to initialize.

--generate-password

Generate a password.

--geo-redundant-backup

Enable Geo-redundant or not for server backup.

Accepted values: Disabled, Enabled
Default value: Disabled
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--server-name -s

Name of the server.

--sku-name

The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.

Default value: GP_Gen5_2
--ssl-enforcement

Enable ssl enforcement or not when connect to server.

Accepted values: Disabled, Enabled
Default value: Enabled
--storage-size

The max storage size of the server. Unit is megabytes.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--version

Server version.

Default value: 10
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.