2
votes

We are working on an app that allows our Azure administrator to monitor Azure Resource requests by people in organization.

There is a requirement where I want to get list of all possible SKUs and SKU capacities through some API if available. I could have hard coded the values but considering the frequency of changes being brought by Microsoft to Azure subscription plans, I wanted to make it more generic and dog feed by Azure itself.

I could not find any API endpoint under Azure Rest API that provides us list of SKUs and Capacities for requested resource type.

Has anyone figured it out already? if not, what is the alternative and better approach?

Rahul.

2
I would speculate that it is not consistent across providers (some might have that feature and some not, and implementation may vary), so be more precise. In general I think there is no simple answer4c74356b41
Exactly, the skus are not consistent across the providers. That's the reason I want to get valid SKUs and Capacities from API rather than keep looking for them and updating them in local database manually. I hope Microsoft has made some sort of provisioning for this. At least, I could not find it on their APIsRahul Patil
There's an API for this. I remember seeing it some time back when they had the documentation on MSDN. I'm not 100% sure but I think it is called Features. Can you try this link: docs.microsoft.com/en-us/rest/api/resources/features?Gaurav Mantri
@GauravMantri I could not get much of an information from features API :-(Rahul Patil
Can you expand a little on the scenario? IOW what problem are you trying to solve specifically - prevent creation of a resource? audit creation of resources? Wrap a UI on resource creation?bmoore-msft

2 Answers

1
votes

The pattern for the Azure SKUs API in Azure Resource Manager is HTTP GET {resourceId}/skus?api-version=...

As others have indicated, there doesn't seem to be a good way to discover which ARM resource types have implemented the SKUs API. If you are looking for a generic option today, I would consider the following approach --

1) Gather a list of ARM resource ids in the subscription(s). You can use the ARM resources API to get this list.

2) For each resource id, call the following to retrieve the SKUs: GET {resourceId}/skus?api-version=...

3) Keep track of which ARM resource types return non-2xx status codes. These resource types do not implement the SKUs API and your code should ignore these resource types today.

Here are a few examples of the SKUs API for two common ARM resource types:

armclient get /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}/skus?api-version=2017-03-30

armclient get /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/serverFarms/{name}/skus?api-version=2014-04-01

0
votes

As 4c74356b41 mentioned some might have that feature and some not. We can get the Azure REST API from the official document. And we can get some List SKU REST APIs, detail please refer to screenshot. You also can give your feedback to the Azure team.

enter image description here