Azure CLI samples for Azure SQL Database
Azure SQL Database can be configured using Azure CLI.
Open Azure Cloud Shell
Azure Cloud Shell is a free, interactive shell that you can use to run the steps in this article. Common Azure tools are preinstalled and configured in Cloud Shell for you to use with your account. Just select the Copy button to copy the code, paste it in Cloud Shell, and then press Enter to run it. There are a few ways to open Cloud Shell:
|Select Try It in the upper-right corner of a code block.|
|Open Cloud Shell in your browser.|
|Select the Cloud Shell button on the menu in the upper-right corner of the Azure portal.|
If you choose to install and use the CLI locally, this topic requires that you are running the Azure CLI version 2.0 or later. Run
az --version to find the version. If you need to install or upgrade, see Install the Azure CLI.
Single database & Elastic pools
The following table includes links to Azure CLI script examples for Azure SQL Database.
|Create a single database and an elastic pool|
|Create a single database and configure a firewall rule||This CLI script example creates a single Azure SQL database and configures a server-level firewall rule.|
|Create elastic pools and move pooled databases||This CLI script example creates SQL elastic pools, and moves pooled Azure SQL databases, and changes compute sizes.|
|Scale a single database and an elastic pool|
|Scale a single database||This CLI script example scales a single Azure SQL database to a different compute size after querying the size information for the database.|
|Scale an elastic pool||This CLI script example scales a SQL elastic pool to a different compute size.|
Learn more about the Single Database Azure CLI API.
The following table includes links to Azure CLI script examples for Azure SQL Database - Managed Instance.
|Create a Managed Instance||This CLI script shows how to create a Managed Instance.|
|Update a Managed Instance||This CLI script shows how to update a Managed Instance.|
|Move a database to another Managed Instance||This CLI script shows how to restore a backup of a database from one instance to another.|
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.