Blog Post

Azure Database Support Blog
1 MIN READ

Stop / Cancel ongoing Azure SQL DB scale operation

Yochanan_Rachamim's avatar
Mar 14, 2019

First published on MSDN on Mar 21, 2018
Scenario:

if you want to cancel updating database pricing tier. this can be due to mistake, or long running scale operation.

Resolution:



    1. open Azure cloud shell or use your local Azure CLI installation.

 

    1. edit the following command with your database details and execute the script

 

$ResourceGroupName = ""
$ServerName = ""
$DatabaseName = ""
#----------------------------------------
$OperationName = (az sql db op list --resource-group $ResourceGroupName --server $ServerName --database $DatabaseName --query "[?state=='InProgress'].name" --out tsv)
if(-not [string]::IsNullOrEmpty($OperationName))
{
(az sql db op cancel --resource-group $ResourceGroupName --server $ServerName --database $DatabaseName --name $OperationName)
"Operation " + $OperationName + " has been canceled"
}
else
{
"No in progress operation found"
}

 



    1. review the output to confirm operation has been canceled.

 

Updated Nov 26, 2020
Version 2.0

2 Comments

  • ms_dba's avatar
    ms_dba
    Brass Contributor

    Cancel option also available from the Azure Portal database Notifications tile.

     

    https://docs.microsoft.com/en-us/azure/azure-sql/database/single-database-scale#cancelling-changes

    A service tier change or compute rescaling operation can be canceled.

     

     

  • Nana-1's avatar
    Nana-1
    Copper Contributor

    The script runs fine but returns a misleading message at the end that wasted some time since it wasn't an actual issue:

    [

    ERROR: Resource group 'RGXXX' could not be found.
    No in progress operation found

    ]