6

I had created some virtual machine on Azure. Is there any APIs, PowerShell scripts or any other way to get the following information in my ASP.NET application report page.

  1. Billing data for individual virtual machine.
  2. Usages data for individual virtual machine.

Thanks

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Vinay Rajput
  • 362
  • 1
  • 4
  • 13

5 Answers5

5

Azure now provides a way for customers to retrieve their usage and pricing details using the new Azure billing APIs: https://weblogs.asp.net/scottgu/new-azure-billing-apis-available

1

Windows Azure does not provide an API for billing/cost metering at the moment. Amazon provides CloudWatch for this.

Windows Azure Pack (for on-premises/SP cloud using Hyper-V) does have an API for cost metering.

The API is one of the most requested features by customers. See this link http://feedback.windowsazure.com/forums/170030-billing/suggestions/1143971-billing-usage-api#comments

I guess Microsoft is working on an API. So at the moment your only option is downloading the CSV. Microsoft recently added a feature which allows to receive email alerts when the monthly costs or total costs reach a customer set threshold.

1

The Azure Usage API can be called by customers and partners to get granular Azure resource usage data (hourly and daily buckets), and the response from this REST API is JSON.

Here are some more helpful links:

High-level article on Azure Billing APIs

Azure Usage API MSDN reference

Azure Billing API code samples on Github

If you have any other questions, please feel free to email me at mobandyo@microsoft.com.

0

I'm waiting for the same features in Azure API. I have reported feature request on github for exporting usage statistics as JSON. Azure team is probably working on it. If there is some possibility to get billing data for individual VM, please write us here about this feature.

  • I got a link related to billing information http://blogs.technet.com/b/systemcenter/archive/2013/07/28/creating-usage-analytics-reports-using-excel-and-performance-point-dashboards.aspx can we try something like that for Azure billing. – Vinay Rajput Nov 08 '13 at 07:48
  • Hmm, looks interesting. If I remember corectly, there is some possibility to download CSV file with actual billing data. But I don't remember where I saw this feature... If it is possible, there is simple way to parse this data. BUT it is true if I remember correctly :D – Michał Smereczyński Nov 08 '13 at 08:04
  • We can download CSV, Excel and PDF from the portal directly from Subscription=>Billing tab. But how can we automate this process by our program.? – Vinay Rajput Nov 08 '13 at 09:03
  • Any other way to automate the download billing excel process by C# or PowerShell? – Vinay Rajput Nov 11 '13 at 10:47
0

In order to retrieve your Azure resource usage data, there is also a new powershell commandlet that you can avail of: get-UsageAggregates.

Example: Switch-AzureMode -Name AzureResourceManager

    Add-AzureAccount 

    Select-AzureSubscription "YOUR-AZURE-SUB-NAME"

    $agggregate = get-UsageAggregates -ReportedStartTime "5/2/2015" -ReportedEndTime "5/5/2015"