serg.salo
serg.salo

Reputation: 580

How to check result of Resource Removal Operation for Azure Resource

Using Resource Management API I can remove Azure resource (https://learn.microsoft.com/en-us/rest/api/resources/resources#Resources_DeleteById). This API returns 202 that removal is accepted - the resource is not removed right away though. The response header in my case contains "x-ms-request-id" value. How can I use it to get the status of this operation? Did the operation succeed? In my case I am removing the Log Analytics Solution resource.

Any help is greatly appreciated.

Upvotes: 0

Views: 628

Answers (1)

Bruce Chen
Bruce Chen

Reputation: 18465

According to your description, I have checked this issue. I assumed that azure would take some time to handle your request, you could leverage Azure resource Get By Id to check your azure resource as follows:

enter image description here

For a simple way, you could leverage resources.azure.com, choose your resource and check the details. I removed my Log Analytics, then I could retrieve the following result:

enter image description here

UPDATE

According to your latest comment, I have checked the REST API again and both tested the operations on ASM and ARM, you could refer to them as follows:

  • For classic Azure Services (ASM)

You could use Get Operation Status with authentication using a management certificate to check the operation status.

  • For ARM

You could follow this tutorial about tracking asynchronous Azure operations. You could use the header values returned by the asynchronous REST operations, then request the related URL with authentication using Azure Active Directory to determine the status of your operation.

Based on your azure service, you need to use the ARM approach.

Upvotes: 0

Related Questions