az sql server

Manage SQL servers.

Commands

az sql server ad-admin Manage a server's Active Directory administrator.
az sql server ad-admin create Create a new server Active Directory administrator.
az sql server ad-admin delete Deletes an existing server Active Directory Administrator.
az sql server ad-admin list Returns a list of server Administrators.
az sql server ad-admin update Update an existing server Active Directory administrator.
az sql server conn-policy Manage a server's connection policy.
az sql server conn-policy show Gets a server's secure connection policy.
az sql server conn-policy update Updates a server's secure connection policy.
az sql server create Create a server.
az sql server delete Deletes a server.
az sql server dns-alias Manage a server's DNS aliases.
az sql server dns-alias create Creates a server dns alias.
az sql server dns-alias delete Deletes the server DNS alias with the given name.
az sql server dns-alias list Gets a list of server DNS aliases for a server.
az sql server dns-alias set Sets a server to which DNS alias should point.
az sql server dns-alias show Gets a server DNS alias.
az sql server firewall-rule Manage a server's firewall rules.
az sql server firewall-rule create Create a firewall rule.
az sql server firewall-rule delete Deletes a firewall rule.
az sql server firewall-rule list List a server's firewall rules.
az sql server firewall-rule show Shows the details for a firewall rule.
az sql server firewall-rule update Update a firewall rule.
az sql server key Manage a server's keys.
az sql server key create Creates a server key.
az sql server key delete Deletes a server key.
az sql server key list Gets a list of server keys.
az sql server key show Shows a server key.
az sql server list List available servers.
az sql server list-usages Returns server usages.
az sql server show Gets a server.
az sql server tde-key Manage a server's encryption protector.
az sql server tde-key set Sets the server's encryption protector.
az sql server tde-key show Gets a server encryption protector.
az sql server update Update a server.
az sql server vnet-rule Manage a server's virtual network rules.
az sql server vnet-rule create Create a virtual network rule to allows access to an Azure SQL server.
az sql server vnet-rule delete Deletes the virtual network rule with the given name.
az sql server vnet-rule list Gets a list of virtual network rules in a server.
az sql server vnet-rule show Gets a virtual network rule.
az sql server vnet-rule update Update a virtual network rule.
az sql server wait Place the CLI in a waiting state until a condition of the SQL server is met.

az sql server create

Create a server.

az sql server create --admin-password
--admin-user
--name
--resource-group
[--assign-identity]
[--location]
[--no-wait]
[--subscription]

Examples

Create a server.

az sql server create -l westus -g mygroup -n myserver -u myadminuser -p myadminpassword

Required Parameters

--admin-password -p

The administrator login password (required for server creation).

--admin-user -u

Administrator username for the server. Once created it cannot be changed.

--name -n

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--resource-group -g

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

Optional Parameters

--assign-identity -i

Generate and assign an Azure Active Directory Identity for this serverfor use with key management services like Azure KeyVault.

--location -l

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

--no-wait

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

--subscription

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

az sql server delete

Deletes a server.

az sql server delete [--ids]
[--name]
[--resource-group]
[--subscription]
[--yes]

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--resource-group -g

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

--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 sql server list

List available servers.

az sql server list [--resource-group]
[--subscription]

Examples

List all servers in the current subscription.

az sql server list

List all servers in a resource group.

az sql server list -g mygroup

Optional Parameters

--resource-group -g

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

--subscription

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

az sql server list-usages

Returns server usages.

az sql server list-usages [--ids]
[--name]
[--resource-group]
[--subscription]

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--resource-group -g

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

--subscription

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

az sql server show

Gets a server.

az sql server show [--ids]
[--name]
[--resource-group]
[--subscription]

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--resource-group -g

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

--subscription

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

az sql server update

Update a server.

az sql server update [--add]
[--admin-password]
[--assign_identity]
[--force-string]
[--ids]
[--name]
[--no-wait]
[--remove]
[--resource-group]
[--set]
[--subscription]

Examples

Update a server. (autogenerated)

az sql server update --admin-password myadminpassword --name MyAzureSQLServer --resource-group MyResourceGroup

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--admin-password -p

The administrator login password.

--assign_identity -i

Generate and assign an Azure Active Directory Identity for this serverfor use with key management services like Azure KeyVault.

--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--no-wait

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

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

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

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--subscription

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

az sql server wait

Place the CLI in a waiting state until a condition of the SQL server is met.

az sql server wait [--created]
[--custom]
[--deleted]
[--exists]
[--ids]
[--interval]
[--name]
[--resource-group]
[--subscription]
[--timeout]
[--updated]

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--interval

Polling interval in seconds.

default value: 30
--name -n

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--resource-group -g

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

--subscription

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

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.