title | description | services | ms.service | ms.subservice | ms.custom | ms.devlang | ms.topic | author | ms.author | ms.reviewer | manager | ms.date |
---|---|---|---|---|---|---|---|---|---|---|---|---|
CLI example-monitor-scale-single Azure SQL database | Microsoft Docs |
Azure CLI example script to monitor and scale a single Azure SQL database |
sql-database |
sql-database |
performance |
azurecli |
sample |
CarlRabeler |
carlrab |
craigg |
10/02/2018 |
This Azure CLI script example scales a single Azure SQL database to a different compute size after querying the size information of the database.
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE cloud-shell-try-it.md]
If you choose to install and use the CLI locally, this article 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.
[!code-azurecli-interactivemain]
Tip
Use az sql db op list to get a list of operations performed on the database and use az sql db op cancel to cancel an update operation on the database.
After the script sample has been run, the following command can be used to remove the resource group and all resources associated with it.
az group delete --name myResourceGroup
This script uses the following commands. Each command in the table links to command specific documentation.
Command | Notes |
---|---|
az group create | Creates a resource group in which all resources are stored. |
az sql server create | Creates a logical server that hosts a database. |
az sql db show-usage | Shows the size usage information for a database. |
az sql db update | Updates database properties (such as the service tier or compute size) or moves a database into, out of, or between elastic pools. |
az group delete | Deletes a resource group including all nested resources. |
For more information on the Azure CLI, see Azure CLI documentation.
Additional SQL Database CLI script samples can be found in the Azure SQL Database documentation.