Ahmed Mohamed
Ahmed Mohamed

Reputation: 464

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

Upvotes: 0

Views: 659

Answers (2)

Ahmed Mohamed
Ahmed Mohamed

Reputation: 464

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 

Upvotes: 1

RoadRunner
RoadRunner

Reputation: 26315

You could use az resource show to show everything about an Azure resource.

So in your case you would do:

az resource show -n "RESOURCE_NAME" -g "RESOURCE_GROUP" --resource-type "RESOURCE_TYPE"

Upvotes: 2

Related Questions