az sql

Manage Azure SQL Databases and Data Warehouses.

Commands

az sql db

Manage databases.

az sql db advanced-threat-protection-setting

Manage a database's advanced threat protection setting.

az sql db advanced-threat-protection-setting show

Gets an advanced threat protection setting.

az sql db advanced-threat-protection-setting update

Update a database's advanced threat protection setting.

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 geo-backup

Manage SQL database geo redundant backups.

az sql db geo-backup list

Gets a list of recoverable databases.

az sql db geo-backup restore

Restore a geo-redundant backup to a new database.

az sql db geo-backup show

Gets a recoverable database, which is a resource representing a database's geo backup.

az sql db import

Imports a bacpac into an existing database.

az sql db ledger-digest-uploads

Manage ledger digest upload settings.

az sql db ledger-digest-uploads disable

Disable uploading ledger digests.

az sql db ledger-digest-uploads enable

Enable uploading ledger digests to an Azure Storage account or to Azure Confidential Ledger. If uploading ledger digests is already enabled, the cmdlet resets the digest storage endpoint to a new value.

az sql db ledger-digest-uploads show

Show the current ledger digest settings.

az sql db list

List databases on a server or elastic pool.

az sql db list-deleted

Gets a list of restorable dropped databases.

az sql db list-editions

Show database editions available for the currently active subscription.

az sql db list-usages

Gets 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 show-deleted

Get the details for a deleted database.

az sql db str-policy

Manage SQL database short term retention policy.

az sql db str-policy set

Update short term retention settings for a live database.

az sql db str-policy show

Show the short term retention policy for a live database.

az sql db str-policy wait

Place the CLI in a waiting state until the policy is set.

az sql db tde

Manage a database's transparent data encryption.

az sql db tde key

Manage a database's encryption protector.

az sql db tde key revalidate

Revalidates a database's encryption protector key.

az sql db tde key revert

Reverts a database's encryption protector key to server level.

az sql db tde set

Sets a database's transparent data encryption configuration.

az sql db tde show

Shows a Transparent Data Encryption.

az sql db threat-policy

Manage a database's threat detection policies.

az sql db threat-policy show

Gets a 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-failover-group-arc

Create or Delete a Failover Group.

az sql instance-failover-group-arc create

Create a failover group resource.

az sql instance-failover-group-arc delete

Delete a failover group resource on a SQL managed instance.

az sql instance-failover-group-arc show

Show a failover group resource.

az sql instance-failover-group-arc update

Update a failover group resource.

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 Directory only settings.

az sql mi ad-only-auth disable

Disable Azure Active Directory only Authentication for this Managed Instance.

az sql mi ad-only-auth enable

Enable Azure Active Directory only Authentication for this Managed Instance.

az sql mi ad-only-auth get

Get a specific Azure Active Directory only Authentication property.

az sql mi advanced-threat-protection-setting

Manage a SQL managed instance's advanced threat protection setting.

az sql mi advanced-threat-protection-setting show

Gets an advanced threat protection setting.

az sql mi advanced-threat-protection-setting update

Update a SQL managed instance's advanced threat protection setting.

az sql mi create

Create a managed instance.

az sql mi delete

Delete a managed instance.

az sql mi dtc

Commands related to managed instance DTC management.

az sql mi dtc show

Get managed instance DTC settings.

az sql mi dtc update

Update managed instance DTC settings.

az sql mi dtc wait

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

az sql mi endpoint-cert

Endpoint certificates management commands.

az sql mi endpoint-cert list

List certificates used on endpoints on the target instance.

az sql mi endpoint-cert show

Get a certificate used on the endpoint with the given id.

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 link

Instance link management commands.

az sql mi link create

Create a distributed availability group between Sql On-Prem and Sql Managed Instance.

az sql mi link delete

Drop a distributed availability group between Sql On-Prem and Sql Managed Instance.

az sql mi link list

Get a list of a distributed availability groups in instance.

az sql mi link show

Get a distributed availability group info.

az sql mi link update

Update a distributed availability group between Sql On-Prem and Sql Managed Instance.

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 partner-cert

Server trust certificate management commands.

az sql mi partner-cert create

Upload a server trust certificate from box to Sql Managed Instance.

az sql mi partner-cert delete

Delete a server trust certificate that was uploaded from box to Sql Managed Instance.

az sql mi partner-cert list

Get a list of server trust certificates that were uploaded from box to the given Sql Managed Instance.

az sql mi partner-cert show

Get a server trust certificate that was uploaded from box to Sql 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

Shows a server encryption protector.

az sql mi update

Update a managed instance.

az sql mi-arc

Manage Azure Arc-enabled SQL managed instances.

az sql mi-arc config

Configuration commands.

az sql mi-arc config add

Add a value for a json path in a config file.

az sql mi-arc config init

Initialize the CRD and specification files for a SQL managed instance.

az sql mi-arc config patch

Patch a config file based on a json patch file.

az sql mi-arc config remove

Remove a value for a json path in a config file.

az sql mi-arc config replace

Replace a value for a json path in a config file.

az sql mi-arc create

Create a SQL managed instance.

az sql mi-arc delete

Delete a SQL managed instance.

az sql mi-arc edit

Deprecated, use update over edit.

az sql mi-arc endpoint

View and manage SQL endpoints.

az sql mi-arc endpoint list

List the SQL endpoints.

az sql mi-arc get-mirroring-cert

Retrieve certificate of availability group mirroring endpoint from sql mi and store in a file.

az sql mi-arc list

List SQL managed instances.

az sql mi-arc reprovision-replica

Reprovision a replica in a SQL managed instance.

az sql mi-arc show

Show the details of a SQL managed instance.

az sql mi-arc update

Update the configuration of a SQL managed instance.

az sql mi-arc upgrade

Upgrade SQL managed instance.

az sql midb

Manage SQL managed instance databases.

az sql midb advanced-threat-protection-setting

Manage a SQL managed instance database's advanced threat protection setting.

az sql midb advanced-threat-protection-setting show

Gets an advanced threat protection setting.

az sql midb advanced-threat-protection-setting update

Update a SQL managed instance database's advanced threat protection setting.

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 recover

Recover a managed database using geo-pair instance backup.

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 midb update

Update a managed database.

az sql midb-arc

Manage databases for Azure Arc-enabled SQL managed instances.

az sql midb-arc restore

Restore a database to an Azure Arc enabled SQL managed instance.

az sql recoverable-midb

Recoverable managed databases command group.

az sql recoverable-midb list

Get all recoverable managed databases for given instance name.

az sql recoverable-midb show

Get recoverable 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

Sets a server's AD admin.

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 Directory only Authentication settings for this Server.

az sql server ad-only-auth disable

Disable Azure Active Directory only Authentication for this Server.

az sql server ad-only-auth enable

Enable Azure Active Directory only Authentication for this Server.

az sql server ad-only-auth get

Get a specific Azure Active Directory only Authentication property.

az sql server advanced-threat-protection-setting

Manage a server's advanced threat protection setting.

az sql server advanced-threat-protection-setting show

Gets an advanced threat protection setting.

az sql server advanced-threat-protection-setting update

Update a server's advanced threat protection setting.

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 ipv6-firewall-rule

Manage a server's ipv6 firewall rules.

az sql server ipv6-firewall-rule create

Create an ipv6 firewall rule.

az sql server ipv6-firewall-rule delete

Deletes an IPv6 firewall rule.

az sql server ipv6-firewall-rule list

List a server's ipv6 firewall rules.

az sql server ipv6-firewall-rule show

Shows the details for an ipv6 firewall rule.

az sql server ipv6-firewall-rule update

Update an ipv6 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

Manage a server's Microsoft support operations.

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 outbound-firewall-rule

Manage a server's outbound firewall rules.

az sql server outbound-firewall-rule create

Create a new outbound firewall rule.

az sql server outbound-firewall-rule delete

Delete the outbound firewall rule.

az sql server outbound-firewall-rule list

List a server's outbound firewall rules.

az sql server outbound-firewall-rule show

Show the details for an outbound firewall rule.

az sql server show

Gets a server.

az sql server tde-key

Manage a server's encryption protector.

az sql server tde-key revalidate

Revalidate a server encryption protector.

az sql server tde-key set

Sets the server's encryption protector. Ensure to create the key first https://docs.microsoft.com/en-us/cli/azure/sql/server/key?view=azure-cli-latest#az-sql-server-key-create.

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 enable-azure-ad-auth

Enable Azure AD authentication of 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 start-assessment

Starts SQL best practice assessment on SQL virtual machine.

az sql vm update

Updates the properties of a SQL virtual machine.

az sql vm validate-azure-ad-auth

Validate Azure AD authentication of a SQL virtual machine at the client side without enabling it.

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.

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.

--yes -y

Do not prompt for confirmation.

default value: False

az sql list-usages

Gets all subscription usage metrics in a given location.

az sql list-usages --location

Required Parameters

--location -l

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

az sql show-usage

Gets a subscription usage metric.

az sql show-usage --location
                  --usage

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

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