I'm looking at the documentation of the rest API and I'm looking to get the costs of my resources.
Looking at both the REST API and SDK for .NET, there's a Consumption endpoint that does this, but on further testing, this only seems to provide the latest available billing cycle (24 hour window).
Example Code:
var filterString = $"properties/instanceName eq \'{vm.VirtualMachineName}\'";
var vmConsumptionData = await consumptionClient.Item1.UsageDetails.ListAsync(
scope: $"/subscriptions/{consumptionClient.subscriptionGuid}",
filter: filterString
);
consumptionClient
is an instance of a consumptionClient returned as part of a Tuple elsewhere.
Result is yesterdays last billed amount.
Are there any other endpoints that would provide a more up to date cost overview of my resources in Azure? I.E. Per minute or hour
The only other way I believe this can be done is to retrieve the 'Usage quantity' of a resource and work this out based on the resources cost per hour.