Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

az postgres flexible-server db

Manage PostgreSQL databases on a flexible server.

Commands

Name Description Type Status
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 db create

Create a PostgreSQL database on a flexible server.

az postgres flexible-server db create --name
 --resource-group
 --server-name
 [--acquire-policy-token]
 [--change-reference]
 [--charset]
 [--collation]

Examples

Create database 'testDatabase' in the flexible server 'testserver' with the default parameters.

az postgres flexible-server db create --resource-group testGroup --server-name testserver --name testDatabase

Create database 'testDatabase' in the flexible server 'testserver' with a given character set and collation rules.

az postgres flexible-server db create --resource-group testGroup --server-name testserver --name testDatabase \ --charset validCharset --collation validCollation

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.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--charset

The charset of the database. The default value is UTF8.

--collation

The collation of the database.

az postgres flexible-server db delete

Delete a database on a flexible server.

az postgres flexible-server db delete [--acquire-policy-token]
 [--change-reference]
 [--ids]
 [--name]
 [--resource-group]
 [--server-name]
 [--subscription]
 [--yes]

Examples

Delete database 'testDatabase' in the flexible server 'testserver'.

az postgres flexible-server db delete --resource-group testGroup --server-name testserver --name testDatabase

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--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.

Property Value
Parameter group: Resource Id Arguments
--name -n

The name of the database.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--server-name -s

Name of the server.

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
--yes -y

Do not prompt for confirmation.

az postgres flexible-server db list

List the databases for a flexible server.

az postgres flexible-server db list [--ids]
 [--resource-group]
 [--server-name]
 [--subscription]

Examples

List databases in the flexible server 'testserver'.

az postgres flexible-server db list --resource-group testgroup --server-name testserver

List databases in the flexible server 'testserver' in table format.

az postgres flexible-server db list --resource-group testgroup --server-name testserver --output table

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--server-name -s

Name of the server.

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments

az postgres flexible-server db show

Show the details of a database.

az postgres flexible-server db show [--ids]
 [--name]
 [--resource-group]
 [--server-name]
 [--subscription]

Examples

Show database 'testDatabase' in the server 'testserver'.

az postgres flexible-server db show --resource-group testGroup --server-name testserver --name testDatabase

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

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

Property Value
Parameter group: Resource Id Arguments
--name -n

The name of the database.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--server-name -s

Name of the server.

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments

Feedback

Was this page helpful?