Search code examples
azureasynchronousconcurrencyazure-cliazure-cli2

How to check if an azure resource is already in use using azure CLI?


Let's assume that an azure resource, ex "storage account" is being updated! at the same time if I run a command like

az storage account update --default-action Allow --name MyStorageAccount --resource-group MyResourceGroup 

It will throw an error

The request failed due to conflict with a concurrent request or something similar

So before running such command, how can I check if the resource is being used like being updated using Azure CLI


Solution

  • I found the what I'm looking for inspired by the above answer at this link az resource wait
    So it will be something like

    az resource wait -n "RESOURCE_NAME" -g "RESOURCE_GROUP" --resource-type "RESOURCE_TYPE" --updated