az postgres db

Manage PostgreSQL databases on a server.

Commands

az postgres db create

Create a PostgreSQL database.

az postgres db delete

Delete a database.

az postgres db list

List the databases for a server.

az postgres db show

Show the details of a database.

az postgres db create

Create a PostgreSQL database.

az postgres db create --name
                      --resource-group
                      --server-name
                      [--charset]
                      [--collation]
                      [--subscription]

Examples

Create database 'testdb' in the server 'testsvr' with the default parameters.

az postgres db create -g testgroup -s testsvr -n testdb

Create database 'testdb' in server 'testsvr' with a given character set and collation rules.

az postgres db create -g testgroup -s testsvr -n testdb --charset {valid_charset} --collation {valid_collation}

Required Parameters

--name -n

The name of the database.

--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. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

Optional Parameters

--charset

The charset of the database.

--collation

The collation of the database.

--subscription

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

az postgres db delete

Delete a database.

az postgres db delete --name
                      --resource-group
                      --server-name
                      [--subscription]
                      [--yes]

Examples

Delete database 'testdb' in the server 'testsvr'.

az postgres db delete -g testgroup -s testsvr -n testdb

Required Parameters

--name -n

The name of the database.

--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. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

Optional Parameters

--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.

az postgres db list

List the databases for a server.

az postgres db list --resource-group
                    --server-name
                    [--query-examples]
                    [--subscription]

Examples

List databases in the server 'testsvr'.

az postgres db list -g testgroup -s testsvr

Required Parameters

--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. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

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

az postgres db show

Show the details of a database.

az postgres db show --name
                    --resource-group
                    --server-name
                    [--query-examples]
                    [--subscription]

Examples

Show database 'testdb' in the server 'testsvr'.

az postgres db show -g testgroup -s testsvr -n testdb

Required Parameters

--name -n

The name of the database.

--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. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

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