Reputation: 529
So for Pay-as-you-Go Azure subscriptions you can use the ConsumptionManagementClient. However, this does not work on Azure Sponsorship or CSP subscriptions. It even states this at https://learn.microsoft.com/en-us/rest/api/consumption/. However, if you do have one of those unsupported subscription types, how do you get usage details?
Basically I want to be able to query the usageDetails of any subscription I am authorized to view in C#. What is the right approach to this?
Seems odd that Microsoft has completely different interfaces like this for usage details. What API/SDK (C#) should I be using when ConsumptionManagementClient doesn't work?
Upvotes: 1
Views: 1118
Reputation: 529
OK, so I was exploring the ARM subscription REST endpoint in more detail and I stumbled upon how to get this directly without the need for the ConsumptionManagementClient. For anyone else that needs this info, you can find it in '/providers/Microsoft.Commerce/UsageAggregates'. I can confirm this is working for both PAYG and sponsored subscriptions.
Upvotes: 1