Search code examples
powershellazurepowershell-cmdlet

Azure billing information with powershell?


Is there any way to get the billing information (time and money spent) for a specific resource group by using powershell?


Solution

  • You can use Get-UsageAggregates cmdlet of Microsoft Azure Powershell to get billing information.

    See this blog post for an example of how to use this Cmdlet: http://blogs.technet.com/b/keithmayer/archive/2015/06/30/export-azure-subscription-usage-with-new-billing-api-and-powershell.aspx.

    First use Login-AzureRmAccount cmdlet and then use below command to get the data.

    Get-UsageAggregates -ReportedStartTime "2016-01-01" -ReportedEndTime "2016-01-07" -AggregationGranularity "Daily" -ShowDetails $true

    enter image description here

    Using above information and data which you can get from RateCard API you can get the cost occurred as well.