如何通过Azure RM REST API获取订阅中已注册的服务列表
Get Only Registered Azure Resource Providers via REST API
Great question! You can easily filter the results to only include registered resource providers by adding the $filter query parameter to your existing API request. Here's how to adjust it:
Modified API Request
GET https://management.azure.com/subscriptions/{subscriptionId}/providers?api-version=2018-02-01&$filter=registrationState eq 'Registered'
Breakdown of the Filter
- The
$filter=registrationState eq 'Registered'clause tells the API to only return resource providers where theregistrationStateproperty exactly matches the valueRegistered. This excludes providers that are in states likeNotRegisteredorRegistering.
Example Response Snippet
{
"value": [
{
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Compute",
"namespace": "Microsoft.Compute",
"registrationState": "Registered",
...
},
...
]
}
Bonus: Azure CLI Equivalent
If you ever need to do this via the Azure CLI instead of REST, you can use this command to get the same filtered list:
az provider list --query "[?registrationState=='Registered']"
内容的提问来源于stack exchange,提问作者kannanchinnakannu
相关产品推荐
相关产品推荐

