title | titleSuffix | description | services | ms.service | ms.subservice | ms.custom | ms.devlang | ms.topic | author | ms.author | ms.reviewer | ms.date | keywords |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure CLI samples for Azure SQL Database & Managed Instances | Microsoft Docs |
Azure SQL Database & SQL Managed Instance |
Find Azure CLI script samples to create and manage Azure SQL Database and Azure SQL Managed Instance. |
sql-database |
sql-db-mi |
deployment-configuration |
overview-samples, mvc, sqldbrb=2, devx-track-azurecli, seo-azure-cli |
azurecli |
sample |
LitKnd |
kendralittle |
mathoma |
12/22/2021 |
sql database, managed instance, azure cli samples, azure cli examples, azure cli code samples, azure cli script examples |
[!INCLUDEappliesto-sqldb-sqlmi]
You can configure Azure SQL Database and SQL Managed Instance by using the Azure CLI.
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE azure-cli-prepare-your-environment.md]
- This tutorial requires version 2.0 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
The following table includes links to Azure CLI script examples to manage single and pooled databases in Azure SQL Database.
Area | Description |
---|---|
Create databases | |
Create a single database | Creates an SQL Database and configures a server-level firewall rule. |
Create pooled databases | Creates elastic pools, moves pooled databases, and changes compute sizes. |
Scale databases | |
Scale a single database | Scales single database. |
Scale pooled database | Scales a SQL elastic pool to a different compute size. |
Configure geo-replication | |
Single database | Configures active geo-replication for a database in Azure SQL Database and fails it over to the secondary replica. |
Pooled database | Configures active geo-replication for a database in an elastic pool, then fails it over to the secondary replica. |
Configure failover group | |
Configure failover group | Configures a failover group for a group of databases and failover over databases to the secondary server. |
Single database | Creates a database and a failover group, adds the database to the failover group, then tests failover to the secondary server. |
Pooled database | Creates a database, adds it to an elastic pool, adds the elastic pool to the failover group, then tests failover to the secondary server. |
Auditing and threat detection | |
Configure auditing and threat-detection | Configures auditing and threat detection policies for a database in Azure SQL Database. |
Back up, restore, copy, and import a database | |
Back up a database | Backs up a database in SQL Database to an Azure storage backup. |
Restore a database | Restores a database in SQL Database to a specific point in time. |
Copy a database to a new server | Creates a copy of an existing database in SQL Database in a new server. |
Import a database from a BACPAC file | Imports a database to SQL Database from a BACPAC file. |
Learn more about the single-database Azure CLI API.
The following table includes links to Azure CLI script examples for Azure SQL Managed Instance.
Area | Description |
---|---|
Create SQL Managed Instance | Creates a SQL Managed Instance. |
Configure Transparent Data Encryption (TDE) | |
Configure Transparent Data Encryption (TDE) | Configures Transparent Data Encryption (TDE) in SQL Managed Instance by using Azure Key Vault with various key scenarios. |
Restore geo-backup | Performs a geo-restore between two instanced of SQL Managed Instance to a specific point in time. |
For additional SQL Managed Instance examples, see the create, update, move a database, and working with scripts.
Learn more about the SQL Managed Instance Azure CLI API.