You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/governance/resource-graph/concepts/arg-get-list-api.md
+61-23Lines changed: 61 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,16 @@ ms.custom: devx-track-csharp
8
8
9
9
# Azure Resource Graph (ARG) GET/LIST API
10
10
11
-
The ARG GET/LIST API significantly reduces READ throttling by serving all incoming GET and LIST calls against ARG platform with smart routing controls in control plane. The API aligns with the existing request and response contracts of Azure control plane APIs while addressing throttling issues for customers.
11
+
The ARG GET/LIST API significantly reduces READ throttling by serving all incoming GET and LIST calls against the ARG platform with smart routing controls in the control plane. The API aligns with the existing request and response contracts of Azure control plane APIs while addressing throttling issues for customers.
12
12
13
-
ARG GET/LIST provides a default quota of 4k /min /user /subscription on a moving window. This range isn't a hard limit; we can support more than this based on scenario requirement. The API provides a response header “x-ms-user-quota-remaining" indicating remaining quota and "x-ms-user-quota-resets-after" indicating the time for a full quota reset based on which you can understand your quota consumption.
13
+
ARG GET/LIST provides a default quota of 4k per minute, user, and subscription, on a moving window. The API provides a response header “x-ms-user-quota-remaining" indicating remaining quota and "x-ms-user-quota-resets-after" indicating the time for a full quota reset based on which you can understand your quota consumption.
14
14
15
15
> [!NOTE]
16
-
> Keep in mind that the Azure Resource Manager (ARM) quota applies to these calls. Read about the [Azure Resource Manager limits](../../../azure-resource-manager/management/request-limits-and-throttling.md#azure-resource-graph-throttling), which are the new limits that ARM follows for Azure Public cloud.
16
+
> Keep in mind that the Azure Resource Manager quota applies to these calls. Read about the [Azure Resource Manager limits](../../../azure-resource-manager/management/request-limits-and-throttling.md#azure-resource-graph-throttling), which are the new limits that ARM follows for Azure Public cloud.
17
17
18
18
## Using the ARG GET/LIST API
19
19
20
-
To use the ARG GET/LIST APIidentify whether or not your scenario matches the conditions mentioned [here](./guidance-for-throttled-requests.md#arg-getlist-api), you can append the flag `&useResourceGraph=true` to your control plane API calls, and the request is routed to the ARG GET/LIST API backend.
20
+
To use the ARG GET/LIST API, first identify whether or not your scenario matches the conditions mentioned in the guidanceforthrottledrequests. You can then append the flag `&useResourceGraph=true` to your applicable GET/LIST API calls, and the request will be routed to the ARG backend for response.
21
21
22
22
Contact the ARG product group by sending an email to Azure Resource Graph team sharing a brief overview of your scenario and the ARG team will reach out to you with next steps. Callers must also design appropriate retry logic and implement fallback mechanisms to ensure smooth and reliable experience. This opt-in model was deliberately chosen to allow the Azure Resource Graph team to better understand customer usage patterns and make improvements as needed.
23
23
@@ -31,35 +31,47 @@ This request is used for looking up a single resource by providing resource D.
31
31
32
32
**Traditional Point Get Request:**
33
33
34
+
```api
34
35
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/{providerNamespace}/{resourceType}/{resourceName}?api-version={apiVersion}
36
+
```
35
37
36
38
**ARG Point Get Request:**
37
39
40
+
```api
38
41
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/{providerNamespace}/{resourceType}/{resourceName}?api-version={apiVersion}&**useResourceGraph=true**
42
+
```
39
43
40
44
## Subscription Collection Get
41
45
42
46
This request is used for listing all resources under a single resource type in a subscription.
43
47
44
48
**Traditional Subscription Collection Get Request:**
45
49
50
+
```api
46
51
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/{providerNamespace}/{resourceType}?api-version={apiVersion}
52
+
```
47
53
48
54
**ARG Subscription Collection Get Request:**
49
55
56
+
```api
50
57
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/{providerNamespace}/{resourceType}?api-version={apiVersion}&**useResourceGraph=true**
58
+
```
51
59
52
60
## Resource Group Collection Get
53
61
54
62
This request is used for listing all resources under a single resource type in a resource group.
55
63
56
64
**Traditional Point Get Request:**
57
65
66
+
```api
58
67
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/{providerNamespace}/{resourceType}?api-version={apiVersion}
68
+
```
59
69
60
70
**ARG GET/LIST Point Get Request:**
61
71
72
+
```api
62
73
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/{providerNamespace}/{resourceType}?api-version={apiVersion}&**useResourceGraph=true**
74
+
```
63
75
64
76
## Some frequently used examples
65
77
@@ -69,53 +81,68 @@ For this specific example, use the following requests to get a virtual machine w
69
81
70
82
#### ARG GET/LIST Request
71
83
84
+
```api
72
85
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachines/{vm}?api-version=2024-07-01&$expand=instanceView&useResourceGraph=true
86
+
```
73
87
74
88
#### ARG Query
75
89
90
+
```sql
76
91
Resources
77
92
78
93
| where type =~ 'microsoft.compute/virtualmachines'
79
94
| where id = ~ '/subscriptions/{subscriptionId}<br>/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachines/{vm}'
95
+
```
80
96
81
97
#### CRP Request
82
98
99
+
```api
83
100
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachines/{vm}?api-version=2024-07-01&$expand=instanceView
84
-
101
+
```
85
102
86
103
### List VMs under ResourceGroup
87
104
88
105
For this specific example, use the following requests to retrieve the list of virtual machines under the resource group.
89
106
90
107
#### ARG GET/LIST Request
91
108
109
+
```api
92
110
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachines?api-version=2024-07-01&$expand=instanceView&useResourceGraph=true
111
+
```
93
112
94
113
#### ARG Query
95
114
115
+
```sxl
96
116
Resources
97
117
98
118
| where resourceGroup =~ ‘{resourceGroup}’
99
119
100
120
| where type =~ 'microsoft.compute/virtualmachines'
121
+
```
101
122
102
123
### CRP Request
103
124
125
+
```api
104
126
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachines?api-version=2024-07-01
127
+
```
105
128
106
129
### List VMSS VM (Uniform) with InstanceView
107
130
108
131
#### ARG GET/LIST Request
109
132
133
+
```api
110
134
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachinescalesets/{vmss}/virtualmachines?api-version=2024-07-01&$expand=instanceView&useResourceGraph=true
135
+
```
111
136
112
137
#### ARG Query
113
138
139
+
```sql
114
140
ComputeResources
115
141
116
142
| where type =~ 'microsoft.compute/virtualmachinescalesets/virtualmachines'
117
143
118
144
| where id startswith ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachinescalesets/{vmss}’
145
+
```
119
146
120
147
### CRP Request
121
148
@@ -127,60 +154,71 @@ For this specific example, use the following requests to retrieve the list of VM
127
154
128
155
### ARG GET/LIST Request
129
156
130
-
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachinescalesets/{vmss}/virtualmachines?api-version=2024-07-01&$filter=’virtualMachineScaleSet/id’ eq ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachinescalesets/{vmss}’&$expand=instanceView&useResourceGraph=true
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachines?api-version=2024-07-01&$expand=instanceView&$filter=’virtualMachineScaleSet/id’ eq ‘/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.compute/virtualmachinescalesets/{vmss}’
175
+
```
143
176
144
177
### List storage accounts in subscription
145
178
146
179
For this specific example, use the following requests to retrieve the list of storage accounts in the subscription.
147
180
148
181
#### ARG GET/LIST request
149
182
183
+
```api
150
184
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.storage/storageAccounts?api-version=2024-01-01&useResourceGraph=true
185
+
```
151
186
152
187
#### ARG Query
153
188
189
+
```sql
154
190
Resources
155
191
156
192
| where type =~ ‘microsoft.storage/storageAccounts’
193
+
```
157
194
158
195
#### SRP request
159
196
197
+
```api
160
198
HTTP GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/microsoft.storage/storageAccounts?api-version=2024-01-01
161
-
199
+
```
162
200
163
201
## Known Limitations
164
202
165
-
1.**VMSS VM Health status**isn't supported by default. If you have a requirement, do let us know by emailing the ARG team.
166
-
2.**Supported Resources** - The ARG GET/LIST API supports all resource types as part of the ‘resources’ and ‘computeresources’ table. If you have a requirement for a specific resource type outside of these tables, do let us know by emailing the ARG team.
167
-
3.**Single API Version Support** - ARG GET/LIST today only supports a single API version for each resource type, which is generally the latest non-preview version of the type that exists in the Azure REST API spec. The `api-version` parameter in the request URL is ignored by the ARG GET/LIST today. ARG GET/LIST returns `apiVersion` field in resource payloads in responses; this is the version that ARG GET/LIST indexed the resource in. Callers can apply this field to understand the apiVersion to use, if its relevant for their scenario.
168
-
4.**Client Support** - Azure REST API: Supported | Azure SDK: Supported [sample .NET code](#sample-sdk-code)| PowerShell: Currently not supported | Azure CLI: Currently not supported | Azure portal: Currently not supported
169
-
5.**Client Deserialization Concerns**
203
+
1.**VMSS VM health status**is not currently supported. If you require this data, you can share your scenario and propose the feature addition on our [feedback forums](https://feedback.azure.com/d365community/forum/675ae472-f324-ec11-b6e6-000d3a4f0da0).
204
+
2.**Supported resources** - The ARG GET/LIST API supports all resource types as part of the `resources` and `computeresources` table. If you require a resource type which is not part of these tables, you can share your scenario and propose the feature addition on our [feedback forums](https://feedback.azure.com/d365community/forum/675ae472-f324-ec11-b6e6-000d3a4f0da0).
205
+
3.**Single API version support** - ARG GET/LIST today only supports a single API version for each resource type, which is generally the latest non-preview version of the type that exists in the Azure REST API spec. The ARG GET/LIST functionality returns the `apiVersion` field in the resource payload of the response which indicates the version of the resource type that was used when retrieving the resource details. Callers can apply this field to understand the API version to use, if its relevant for their scenario.
206
+
4.**Client support** - Azure REST API: Supported | Azure SDK: Supported [sample .NET code](#sample-sdk-code)| PowerShell: Currently not supported | Azure CLI: Currently not supported | Azure portal: Currently not supported
207
+
5.**Client deserialization concerns**
170
208
- If a client uses REST API to issue GET calls, there should generally be no concerns regarding deserialization due to API version differences.
171
209
- If a client uses Azure SDK to issue GET calls, due to relaxed deserialization setting across all languages, the deserialization issue shouldn't be a concern, unless there are contract breaking changes among different versions for the target resource type.
172
-
6.**Unprocessable Resource Request**
173
-
- There are rare scenarios where ARG GET/LIST isn't able to index a resource correctly, other than the existence of the resource. To not sacrifice data quality, ARG GET/LIST refuses serving GET calls for these resources and return an error code of HTTP 422.
174
-
- Clients of ARG GET/LIST should treat HTTP 422 as a permanent error. Clients should retry by falling back to the resource provider (by removing useResourceGraph=true flag). Since the error is applicable specifically to ARG GET/LIST, fallback to resource providers should result in an E2E success.
175
-
7.**Consistency**
176
-
-As an index of Azure resources, ARG GET/LIST ingests the latest updates within seconds. ARG GET/LIST therefore provides a strict bounded staleness consistency level for all resources. This differs from the strong consistency model of Resource Providers.
210
+
6.**Unprocessable resource request**
211
+
- There are rare scenarios where ARG GET/LIST isn't able to index a resource correctly, other than the existence of the resource. To not sacrifice data quality, ARG GET/LIST refuses serving GET calls for these resources and returns an error code of HTTP 422.
212
+
- Clients of ARG GET/LIST should treat HTTP 422 as a permanent error. Clients should retry by falling back to the resource provider (by removing `useResourceGraph=true` flag). Since the error is applicable specifically to ARG GET/LIST, fallback to resource providers should result in an E2E success.
213
+
7.**Supported consistency level**
214
+
-When using ARG GET or LIST, the data you receive reflects recent changes with a slight delay—typically just a few seconds—rather than real-time updates. This is known as 'bounded staleness' and ensures fast, scalable queries while still providing a consistent and up-to-date view of your Azure resources. Unlike direct calls to Resource Providers, which guarantee real-time accuracy (strong consistency), ARG is optimized for performance with predictable, near-real-time data.
177
215
- In resource Point Get responses, ARG GET/LIST provides a response header x-ms-arg-snapshot-timestamp that indicates the timestamp when the returned resource snapshot was indexed. The value of the header is UTC time in ISO8601 format. (An example, "x-ms-arg-snapshot-timestamp" : "2023-01-20T18:55:59.5610084Z").
178
216
179
217
### Sample SDK code
180
218
181
219
The following example is a .NET Code sample to call ARG GET/LIST API by creating an ARMClient with policy that adds the flag `useResourceGraph=true` to each call:
182
220
183
-
First, We create custom ArmClientOption with policy that adds the `useResourceGraph=True` flag per call:
221
+
First, we create custom ArmClientOption with policy that adds the `useResourceGraph=True` flag per call:
184
222
185
223
```bicep
186
224
var armClientOptions = new ArmClientOptions();
@@ -244,22 +282,22 @@ There are a few ways that you can identify when a request the ARG GET/LIST:
244
282
245
283
2. How do you know which API version was used by ARG GET/LIST?
246
284
247
-
This value is returned in “apiVersion” field in resource response today.
285
+
This value is returned in `apiVersion` field in resource response today.
248
286
249
287
3. What happens if a caller calls ARG GET/LIST API with `useResourceGraph=true` flag for a resource not supported by ARG GET/LIST?
250
288
251
-
Any unsupported/unroutable requests result in `useResourceGraph=true` ignored and the call is automatically routed to the resource provider. The user doesn't have to take any action.
289
+
Any unsupported/unroutable requests result in `useResourceGraph=true` ignored, and the call is automatically routed to the resource provider. The user doesn't have to take any action.
252
290
253
291
4. What permissions are required for querying ARG GET/LIST APIs?
254
292
255
-
No special permissions are required for ARG GET/LIST APIs; ARG GET/LIST APIs are equivalent to native Resource provider based GET APIs and therefore, standard RBAC applies. Callers need to have at least READ permissions to resources/scopes they're trying to access.
293
+
No special permissions are required for ARG GET/LIST APIs; ARG GET/LIST APIs are equivalent to native resource provider based GET APIs and therefore, standard RBAC applies. Callers need to have at least READ permissions to resources/scopes they're trying to access.
256
294
257
295
5. What is the rollback strategy, if we find issues while using ARG GET/LIST APIs?
258
296
259
-
If onboarded through the flag `useResourceGraph=true`, the caller may choose to remove the flag (or) set the value to `useResourceGraph=false`, and the call is automatically routed to be Resource Provider.
297
+
If onboarded through the flag `useResourceGraph=true`, the caller may choose to remove the flag (or) set the value to `useResourceGraph=false`, and the call is automatically routed to the Resource Provider.
260
298
261
299
6. What if you're getting a 404 Not Found when trying to get a resource from ARG GET/LIST that was recently created?
262
300
263
301
This is a common scenario with many services where customers create resources and immediately issue a GET in 1-2 seconds part of another WRITE workflow. For example, customers create a new resource and right after trying to create a metric alert that monitors it. The resource might not have been indexed by ARG GET/LIST yet. There are two ways to work around this situation:
264
302
- Retry on ARG GET/LIST a few times until it returns status code 200.
265
-
- Retry without ARG GET/LIST flag to fall back on the resource provider. True 404 seconds doesn't hit the RP since ARM returns the error directly, whereas a false 404 should be served by the resource providers to get actual data.
303
+
- Retry without ARG GET/LIST flag to fall back on the resource provider. True status code 404 doesn't hit the resource provider since ARM returns the error directly, whereas a false 404 should be served by the resource providers to get actual data.
0 commit comments