Azure CLI reference commands for Azure SQL

The Azure Command-Line Interface (CLI) is a set of commands used to create and manage Azure resources. It's available across many Azure services and gives you the ability to manage Azure SQL services from a command-line.

The Azure CLI commands for Azure SQL is composed of core references only and ships as part of the Azure CLI. See az sql for an alphabetic list of the Azure CLI core and extension references available for the Azure SQL service. For references for each subgroup, see the tables in the following sections:

SQL database references

Reference Description More information
az sql db Manage Azure SQL Database. What is Azure SQL Database?
az sql db audit-policy Manage a SQL database's auditing policy. Auditing for Azure SQL Database
az sql db classification Manage a SQL database's sensitivity classifications. Data discovery and classification
az sql db classification recommendation Manage a database's sensitivity classification recommendations. Data discovery and classification
az sql db ltr-backup Manage a SQL database's long-term retention backup. Long-term retention
az sql db ltr-policy Manage a SQL database's long-term retention policy. Manage Azure SQL Database long-term backup retention
az sql db op Manage the operations on a SQL database. Configure and manage content reference
az sql db replica Manage replication between SQL databases. Replication to Azure SQL Database
az sql db tde Manage a SQL database's transparent data encryption. Transparent data encryption
az sql db threat-policy Manage a SQL database's threat detection policies. Configure Advanced Threat Protection

SQL Managed Instance references

Reference Description More information
az sql mi Manage Azure SQL Managed Instance. What is Azure SQL Managed Instance?
az sql mi ad-admin Manage a SQL Managed Instance's Active Directory administrator. Configure and manage Azure AD authentication with Azure SQL
az sql mi ad-only-auth Manage a SQL Managed Instance Azure Active Directory-only settings. Configure and manage Azure AD authentication with Azure SQL
az sql mi key Manage a SQL Managed Instance's keys. Configure Always Encrypted by using Azure Key Vault
az sql mi op Manage operations on a SQL Managed Instance. Overview of Azure SQL Managed Instance management operations
az sql mi tde-key Manage a SQL Managed Instance's encryption protector. Transparent data encryption

SQL Managed Instance database references

Reference Description More information
az sql midb Manage Azure SQL Managed Instance databases. What is Azure SQL Managed Instance?
az sql midb log-replay Manage Log Replay service commands for an Azure SQL Managed Instance database. Migrate databases from SQL Server to SQL Managed Instance by using Log Replay Service
az sql midb ltr-backup Manage SQL Managed Instance database long-term retention backups. Manage Azure SQL Managed Instance long-term backup retention
az sql midb ltr-policy Manage SQL Managed Instance database long-term retention policy. Long-term retention
az sql midb short-term-retention-policy Manage SQL Managed Instance database backup short-term retention policy. Automated backups

SQL server references

Reference Description More information
az sql server Manage SQL Database servers. Create and manage servers
az sql server ad-admin Manage a server's Active Directory administrator. Configure and manage Azure AD authentication with Azure SQL
az sql server ad-only-auth Manage Azure Active Directory-only Authentication settings for a server. Configure and manage Azure AD authentication with Azure SQL
az sql server audit-policy Manage a server's audit policy. Auditing for Azure SQL Database
az sql server conn-policy Manage a server's connection policy. Azure SQL connectivity settings
az sql server dns-alias Manage a server's DNS aliases. DNS alias for Azure SQL Database
az sql server firewall-rule Manage a server's firewall rules. Azure SQL Database and Azure Synapse IP firewall rules
az sql server key Manage a server's keys. Enable Transparent Data Encryption with customer-managed key from Azure Key Vault
az sql server ms-support audit-policy Manage the audit policy of a server's Microsoft support operations. Auditing for Azure SQL Database and Azure Synapse Analytics
az sql server tde-key Manage a server's encryption protector. Enable Transparent Data Encryption with customer-managed key from Azure Key Vault
az sql server vnet-rule Manage a server's virtual network rules. Use virtual network service endpoints and rules for servers

SQL virtual machine references

Reference Description More information
az sql vm Manage SQL virtual machines. What is SQL Server on Azure Virtual Machines
az sql vm group Manage SQL virtual machine groups. Always On availability group on SQL Server on Azure VMs
az sql vm group ag-listener Manage SQL availability group listeners. Configure one or more Always On availability group listeners

Additional SQL references

Reference Description More information
az sql Manage Azure SQL. What is Azure SQL?
az sql dw Manage data warehouses. What is dedicated SQL pool (formerly SQL DW) in Azure Synapse Analytics?
az sql elastic-pool Manage elastic pools. Elastic pools
az sql elastic-pool op Manage operations on an elastic pool. Elastic pools
az sql failover-group Manage SQL Database failover groups. Configure a failover group
az sql instance-failover-group Use SQL Managed Instance failover groups. Configure a failover group
az sql instance-pool Use Manage Instance pools. What is an Azure SQL Managed Instance pool?
az sql stg Manage Server Trust Groups. Use Server Trust Groups
az sql virtual-cluster Manage the virtual cluster of a SQL Managed Instance. Virtual cluster connectivity architecture

See also