title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | ms.devlang | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|
PowerShell example-monitor-scale-elastic pool-Azure SQL Database |
Azure PowerShell example script to monitor and scale an elastic pool in Azure SQL Database |
WilliamDAssafMSFT |
wiassaf |
wiassaf, mathoma |
07/28/2022 |
sql-database |
performance |
sample |
|
powershell |
[!INCLUDEappliesto-sqldb]
This PowerShell script example monitors the performance metrics of an elastic pool, scales it to a higher compute size, and creates an alert rule on one of the performance metrics.
[!INCLUDE quickstarts-free-trial-note] [!INCLUDE updated-for-az] [!INCLUDE cloud-shell-try-it.md]
If you choose to install and use PowerShell locally, this tutorial requires Az PowerShell 1.4.0 or later. If you need to upgrade, see Install Azure PowerShell module. If you are running PowerShell locally, you also need to run Connect-AzAccount
to create a connection with Azure.
[!code-powershell-interactivemain]
Use the following command to remove the resource group and all resources associated with it.
Remove-AzResourceGroup -ResourceGroupName $resourcegroupname
This script uses the following commands. Each command in the table links to command-specific documentation.
Command | Notes |
---|---|
New-AzResourceGroup | Creates a resource group in which all resources are stored. |
New-AzSqlServer | Creates a server that hosts databases or elastic pools. |
New-AzSqlElasticPool | Creates an elastic pool. |
New-AzSqlDatabase | Creates a database in a server. |
Get-AzMetric | Shows the size usage information for the database. |
Set-AzSqlElasticPool | Updates elastic pool properties. |
Add-AzMetricAlertRule | (DeprecateD) Adds or updates an alert rule to automatically monitor metrics in the future. Applies only to classic metric-based alert rules. |
Add-AzMetricAlertRuleV2 | Adds or updates an alert rule to automatically monitor metrics in the future. Applies only to non-classic metric-based alert rules. |
Remove-AzResourceGroup | Deletes a resource group including all nested resources. |
For more information on Azure PowerShell, see Azure PowerShell documentation.
Additional PowerShell script samples can be found in Azure PowerShell scripts.