az sql

Manage Azure SQL Databases and Data Warehouses.

Commands

az sql db

Manage databases.

az sql db audit-policy

Manage a database's auditing policy.

az sql db audit-policy show

Show database audit policy.

az sql db audit-policy update

Update a database's auditing policy.

az sql db audit-policy wait

Place the CLI in a waiting state until a condition of the database's audit policy is met.

az sql db classification

Manage sensitivity classifications.

az sql db classification delete

Delete the sensitivity classification of a given column.

az sql db classification list

Get the sensitivity classifications of a given database.

az sql db classification recommendation

Manage sensitivity classification recommendations.

az sql db classification recommendation disable

Disable sensitivity recommendations for a given column (recommendations are enabled by default on all columns).

az sql db classification recommendation enable

Enable sensitivity recommendations for a given column (recommendations are enabled by default on all columns).

az sql db classification recommendation list

List the recommended sensitivity classifications of a given database.

az sql db classification show

Get the sensitivity classification of a given column.

az sql db classification update

Update a columns's sensitivity classification.

az sql db copy

Create a copy of a database.

az sql db create

Create a database.

az sql db delete

Delete a database.

az sql db export

Export a database to a bacpac.

az sql db import

Imports a bacpac into an existing database.

az sql db list

List databases a server or elastic pool.

az sql db list-deleted

Gets a list of deleted databases that can be restored.

az sql db list-editions

Show database editions available for the currently active subscription.

az sql db list-usages

Returns database usages.

az sql db ltr-backup

Manage SQL database long term retention backups.

az sql db ltr-backup delete

Delete a long term retention backup.

az sql db ltr-backup list

List the long term retention backups for a location, server or database.

az sql db ltr-backup restore

Restore a long term retention backup to a new database.

az sql db ltr-backup show

Get a long term retention backup for a database.

az sql db ltr-backup wait

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

az sql db ltr-policy

Manage SQL database long term retention policy.

az sql db ltr-policy set

Update long term retention settings for a database.

az sql db ltr-policy show

Show the long term retention policy for a database.

az sql db op

Manage operations on a database.

az sql db op cancel

Cancels the asynchronous operation on the database.

az sql db op list

Gets a list of operations performed on the database.

az sql db rename

Rename a database.

az sql db replica

Manage replication between databases.

az sql db replica create

Create a database as a readable secondary replica of an existing database.

az sql db replica delete-link

Permanently stop data replication between two database replicas.

az sql db replica list-links

List the replicas of a database and their replication status.

az sql db replica set-primary

Set the primary replica database by failing over from the current primary replica database.

az sql db restore

Create a new database by restoring from a backup.

az sql db show

Get the details for a database.

az sql db show-connection-string

Generates a connection string to a database.

az sql db tde

Manage a database's transparent data encryption.

az sql db tde list-activity

Returns a database's transparent data encryption operation result.

az sql db tde set

Sets a database's transparent data encryption configuration.

az sql db tde show

Gets a database's transparent data encryption configuration.

az sql db threat-policy

Manage a database's threat detection policies.

az sql db threat-policy show

Gets a database's threat detection policy.

az sql db threat-policy update

Update a database's threat detection policy.

az sql db update

Update a database.

az sql down

Delete the SQL server and its cached information.

az sql dw

Manage data warehouses.

az sql dw create

Create a data warehouse.

az sql dw delete

Delete a data warehouse.

az sql dw list

List data warehouses for a server.

az sql dw pause

Pauses a datawarehouse.

az sql dw resume

Resumes a datawarehouse.

az sql dw show

Get the details for a data warehouse.

az sql dw update

Update a data warehouse.

az sql elastic-pool

Manage elastic pools.

az sql elastic-pool create

Create an elastic pool.

az sql elastic-pool delete

Deletes an elastic pool.

az sql elastic-pool list

Gets all elastic pools in a server.

az sql elastic-pool list-dbs

Gets a list of databases in an elastic pool.

az sql elastic-pool list-editions

List elastic pool editions available for the active subscription.

az sql elastic-pool op

Manage operations on an elastic pool.

az sql elastic-pool op cancel

Cancels the asynchronous operation on the elastic pool.

az sql elastic-pool op list

Gets a list of operations performed on the elastic pool.

az sql elastic-pool show

Gets an elastic pool.

az sql elastic-pool update

Update an elastic pool.

az sql failover-group

Manage SQL Failover Groups.

az sql failover-group create

Creates a failover group.

az sql failover-group delete

Deletes a failover group.

az sql failover-group list

Lists the failover groups in a server.

az sql failover-group set-primary

Set the primary of the failover group by failing over all databases from the current primary server.

az sql failover-group show

Gets a failover group.

az sql failover-group update

Updates the failover group.

az sql instance-failover-group

Manage SQL Instance Failover Groups.

az sql instance-failover-group create

Creates an instance failover group between two connected managed instances.

az sql instance-failover-group delete

Deletes a failover group.

az sql instance-failover-group set-primary

Set the primary of the instance failover group by failing over all databases from the current primary managed instance.

az sql instance-failover-group show

Gets a failover group.

az sql instance-failover-group update

Updates the instance failover group.

az sql instance-pool

Manage instance pools.

az sql instance-pool create

Create an instance pool.

az sql instance-pool delete

Delete an instance pool.

az sql instance-pool list

List available instance pools.

az sql instance-pool show

Get the details for an instance pool.

az sql instance-pool update

Update an instance pool.

az sql instance-pool wait

Wait for an instance pool to reach a desired state.

az sql list-usages

Gets all subscription usage metrics in a given location.

az sql mi

Manage SQL managed instances.

az sql mi ad-admin

Manage a managed instance's Active Directory administrator.

az sql mi ad-admin create

Creates a new managed instance Active Directory administrator.

az sql mi ad-admin delete

Deletes an existing managed instance Active Directory Administrator.

az sql mi ad-admin list

Returns a list of managed instance Active Directory Administrators.

az sql mi ad-admin update

Updates an existing managed instance Active Directory administrator.

az sql mi ad-only-auth

Manage a Managed Instance's Azure Active Directly only settings.

az sql mi ad-only-auth disable

Disable Azure Active Directly only Authentication for this Managed Instance.

az sql mi ad-only-auth enable

Enable Azure Active Directly only Authentication for this Managed Instance.

az sql mi ad-only-auth get

Get a specific Azure Active Directly only Authentication property.

az sql mi create

Create a managed instance.

az sql mi delete

Delete a managed instance.

az sql mi failover

Failover a managed instance.

az sql mi key

Manage a SQL Instance's keys.

az sql mi key create

Creates a SQL Instance key.

az sql mi key delete

Deletes a SQL Instance key.

az sql mi key list

Gets a list of managed instance keys.

az sql mi key show

Shows a SQL Instance key.

az sql mi list

List available managed instances.

az sql mi op

Manage operations on a managed instance.

az sql mi op cancel

Cancels the asynchronous operation on the managed instance.

az sql mi op list

Gets a list of operations performed on the managed instance.

az sql mi op show

Gets a management operation on a managed instance.

az sql mi show

Get the details for a managed instance.

az sql mi tde-key

Manage a SQL Instance's encryption protector.

az sql mi tde-key set

Sets the SQL Instance's encryption protector.

az sql mi tde-key show

Gets a managed instance encryption protector.

az sql mi update

Update a managed instance.

az sql midb

Manage SQL managed instance databases.

az sql midb create

Create a managed database.

az sql midb delete

Delete a managed database.

az sql midb list

List managed databases on a managed instance.

az sql midb list-deleted

List restorable deleted managed databases.

az sql midb log-replay

SQL Managed Instance database Log Replay service commands.

az sql midb log-replay complete

Complete Log Replay service on specified database.

az sql midb log-replay show

Get status of Log Replay service.

az sql midb log-replay start

Start Log Replay service on specified database.

az sql midb log-replay stop

Stop Log Replay service.

az sql midb log-replay wait

Place the CLI in a waiting state until a condition of the managed database is met.

az sql midb ltr-backup

Manage SQL Managed Instance database long term retention backups.

az sql midb ltr-backup delete

Delete a long term retention backup.

az sql midb ltr-backup list

List the long term retention backups for a location, instance or database.

az sql midb ltr-backup restore

Restore a long term retention backup to a new database.

az sql midb ltr-backup show

Get a long term retention backup for a managed database.

az sql midb ltr-backup wait

Place the CLI in a waiting state until a condition of the managed database is met.

az sql midb ltr-policy

Manage SQL Managed Instance database long term retention policy.

az sql midb ltr-policy set

Update long term retention settings for a managed database.

az sql midb ltr-policy show

Show the long term retention policy for a managed database.

az sql midb restore

Restore a managed database.

az sql midb short-term-retention-policy

Manage SQL Managed Instance database backup short term retention policy.

az sql midb short-term-retention-policy set

Update short term retention for automated backups on a single database.

az sql midb short-term-retention-policy show

Show short term retention for automated backups on a single database.

az sql midb show

Get the details for a managed database.

az sql server

Manage SQL servers.

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 the Azure Active Directory administrator with the given name.

az sql server ad-admin list

Gets a list of Azure Active Directory administrators in a server.

az sql server ad-admin update

Update an existing server Active Directory administrator.

az sql server ad-only-auth

Manage Azure Active Directly only Authentication settings for this Server.

az sql server ad-only-auth disable

Disable Azure Active Directly only Authentication for this Server.

az sql server ad-only-auth enable

Enable Azure Active Directly only Authentication for this Server.

az sql server ad-only-auth get

Get a specific Azure Active Directly only Authentication property.

az sql server audit-policy

Manage a server's auditing policy.

az sql server audit-policy show

Show server audit policy.

az sql server audit-policy update

Update a server's auditing policy.

az sql server audit-policy wait

Place the CLI in a waiting state until a condition of the server's audit policy is met.

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 ms-support
az sql server ms-support audit-policy

Manage a server's Microsoft support operations auditing policy.

az sql server ms-support audit-policy show

Show server Microsoft support operations audit policy.

az sql server ms-support audit-policy update

Update a server's Microsoft support operations auditing policy.

az sql server ms-support audit-policy wait

Place the CLI in a waiting state until a condition of the server's Microsoft support operations audit policy is met.

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 show-usage

Gets a subscription usage metric.

az sql stg

Manage Server Trust Groups.

az sql stg create

Create a Server Trust Group.

az sql stg delete

Delete a Server Trust Group.

az sql stg list

Retrieve a list of Server Trust Groups.

az sql stg show

Retrieve a Server Trust Group.

az sql up

Set up an Azure Database for SQL server and configurations.

az sql virtual-cluster

Manage SQL virtual clusters.

az sql virtual-cluster delete

Delete a virtual cluster.

az sql virtual-cluster list

List available virtual clusters.

az sql virtual-cluster show

Get the details for a virtual cluster.

az sql vm

Manage SQL virtual machines.

az sql vm add-to-group

Adds SQL virtual machine to a SQL virtual machine group.

az sql vm create

Creates a SQL virtual machine.

az sql vm delete

Deletes a SQL virtual machine.

az sql vm group

Manage SQL virtual machine groups.

az sql vm group ag-listener

Manage SQL availability group listeners.

az sql vm group ag-listener create

Creates an availability group listener.

az sql vm group ag-listener delete

Deletes an availability group listener.

az sql vm group ag-listener list

Lists all availability group listeners in a SQL virtual machine group.

az sql vm group ag-listener show

Gets an availability group listener.

az sql vm group ag-listener update

Updates an availability group listener.

az sql vm group create

Creates a SQL virtual machine group.

az sql vm group delete

Deletes a SQL virtual machine group.

az sql vm group list

Lists all SQL virtual machine groups in a resource group or subscription.

az sql vm group show

Gets a SQL virtual machine group.

az sql vm group update

Updates a SQL virtual machine group if there are not SQL virtual machines attached to the group.

az sql vm list

Lists all SQL virtual machines in a resource group or subscription.

az sql vm remove-from-group

Remove SQL virtual machine from its current SQL virtual machine group.

az sql vm show

Gets a SQL virtual machine.

az sql vm update

Updates the properties of a SQL virtual machine.

az sql down

Delete the SQL server and its cached information.

az sql down [--delete-group]
            [--no-wait]
            [--resource-group]
            [--server-name]
            [--yes]

Examples

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

az sql down

Delete the resource group and the full cache.

az sql down --delete-group

Optional Parameters

--delete-group

Delete the resource group.

--no-wait

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

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

--yes -y

Do not prompt for confirmation.

az sql list-usages

Gets all subscription usage metrics in a given location.

az sql list-usages --location
                   [--subscription]

Required Parameters

--location -l

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

Optional Parameters

--subscription

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

az sql show-usage

Gets a subscription usage metric.

az sql show-usage --location
                  --usage
                  [--subscription]

Required Parameters

--location -l

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

--usage -u

Name of usage metric to return.

Optional Parameters

--subscription

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

az sql up

Set up an Azure Database for SQL server and configurations.

az sql up [--admin-password]
          [--admin-user]
          [--database-name]
          [--generate-password]
          [--location]
          [--resource-group]
          [--server-name]
          [--tags]
          [--version]

Examples

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

az sql up

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

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

--database-name -d

The name of a database to initialize.

--generate-password

Generate a password.

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

--tags

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

--version

Server version.

default value: 12.0