Skip to content

Commit 02e5ee8

Browse files
Merge pull request #262414 from tfitzmac/0104async
add permissions for status tracking
2 parents e7d83fd + 5bde350 commit 02e5ee8

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

articles/azure-resource-manager/management/async-operations.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Status of asynchronous operations
33
description: Describes how to track asynchronous operations in Azure. It shows the values you use to get the status of a long-running operation.
44
ms.topic: conceptual
5-
ms.date: 01/31/2022
5+
ms.date: 01/04/2024
66
ms.custom: seodec18
77
---
88
# Track asynchronous Azure operations
@@ -16,7 +16,7 @@ An asynchronous operation initially returns an HTTP status code of either:
1616
* 201 (Created)
1717
* 202 (Accepted)
1818

19-
However, that status code doesn't necessarily mean the operation is asynchronous. An asynchronous operation also returns a value for `provisioningState` that indicates the operation hasn't finished. The value can vary by operation but won't include **Succeeded**, **Failed**, or **Canceled**. Those three values indicate the operation has finished. If no value is returned for `provisioningState`, the operation has finished and succeeded.
19+
However, that status code doesn't necessarily mean the operation is asynchronous. An asynchronous operation also returns a value for `provisioningState` that indicates the operation isn't finished. The value can vary by operation but doesn't include **Succeeded**, **Failed**, or **Canceled**. Those three values indicate the operation finished. If no value is returned for `provisioningState`, the operation finished and succeeded.
2020

2121
When the operation successfully completes, it returns either:
2222

@@ -36,18 +36,28 @@ There are two different ways to monitor the status the asynchronous operation. Y
3636

3737
If `Azure-AsyncOperation` isn't one of the header values, then look for:
3838

39-
* `Location` - URL for determining when an operation has completed. Use this value only when `Azure-AsyncOperation` isn't returned.
39+
* `Location` - URL for determining when an operation is completed. Use this value only when `Azure-AsyncOperation` isn't returned.
4040
* `Retry-After` - The number of seconds to wait before checking the status of the asynchronous operation.
4141

42+
When the `Retry-after` header isn't returned, [implement your own retry logic](/azure/architecture/best-practices/retry-service-specific#general-rest-and-retry-guidelines).
43+
4244
> [!NOTE]
4345
> Your REST client must accept a minimum URL size of 4 KB for `Azure-AsyncOperation` and `Location`.
4446
45-
> [!NOTE]
46-
> When the `Retry-after` header is not returned, implement your own retry logic by following the Azure guidelines in [this](https://learn.microsoft.com/azure/architecture/best-practices/retry-service-specific#general-rest-and-retry-guidelines) document.
47+
## Permission for tracking async status
48+
49+
To track the status of an asynchronous operation, you need sufficient permission at the level of the resource group. If you only have permission at the level of the resource, you can start the operation but you can't track its status. Permission at the level of the resource group is required because the URL for tracking status isn't scoped to the resource.
50+
51+
For example, to start a virtual machine, you need the Virtual Machine Contributor role for the resource group that contains the virtual machine. The URL for tracking a start request doesn't include the virtual machine in its path.
52+
53+
```HTTP
54+
GET
55+
https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/{region}/operations/{operation-id}?api-version=2019-12-01
56+
```
4757

4858
## Azure-AsyncOperation request and response
4959

50-
If you have a URL from the `Azure-AsyncOperation` header value, send a GET request to that URL. Use the value from `Retry-After` to schedule how often to check the status. You'll get a response object that indicates the status of the operation. A different response is returned when checking the status of the operation with the `Location` URL. For more information about the response from a location URL, see [Create storage account (202 with Location and Retry-After)](#create-storage-account-202-with-location-and-retry-after).
60+
If you have a URL from the `Azure-AsyncOperation` header value, send a GET request to that URL. Use the value from `Retry-After` to schedule how often to check the status. You get a response object that indicates the status of the operation. A different response is returned when checking the status of the operation with the `Location` URL. For more information about the response from a location URL, see [Create storage account (202 with Location and Retry-After)](#create-storage-account-202-with-location-and-retry-after).
5161

5262
The response properties can vary but always include the status of the asynchronous operation.
5363

@@ -81,13 +91,13 @@ The error object is returned when the status is Failed or Canceled. All other va
8191

8292
## provisioningState values
8393

84-
Operations that create, update, or delete (PUT, PATCH, DELETE) a resource typically return a `provisioningState` value. When an operation has completed, one of following three values is returned:
94+
Operations that create, update, or delete (PUT, PATCH, DELETE) a resource typically return a `provisioningState` value. When an operation completes, one of following three values is returned:
8595

8696
* Succeeded
8797
* Failed
8898
* Canceled
8999

90-
All other values indicate the operation is still running. The resource provider can return a customized value that indicates its state. For example, you may receive **Accepted** when the request is received and running.
100+
All other values indicate the operation is still running. The resource provider can return a customized value that indicates its state. For example, you receive **Accepted** when the request is received and running.
91101

92102
## Example requests and responses
93103

@@ -106,7 +116,7 @@ It returns status code 202. Among the header values, you see:
106116
Azure-AsyncOperation : https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Compute/locations/{region}/operations/{operation-id}?api-version=2019-12-01
107117
```
108118

109-
To check the status of the asynchronous operation, sending another request to that URL.
119+
To check the status of the asynchronous operation, send another request to that URL.
110120

111121
```HTTP
112122
GET
@@ -203,7 +213,7 @@ GET
203213
https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Storage/operations/{operation-id}?monitor=true&api-version=2019-06-01
204214
```
205215

206-
If the request is still running, you receive a status code 202. If the request has completed, your receive a status code 200. The body of the response contains the properties of the storage account that was created.
216+
If the request is still running, you receive a status code 202. If the request is completed, your receive a status code 200. The body of the response contains the properties of the storage account that was created.
207217

208218
## Next steps
209219

0 commit comments

Comments
 (0)