Search code examples
azureazure-powershellazure-billing-api

Issue with 'continuationtoken' with Get-UsageAggregates PowerShell cmdlet


I am following the blog, to fetch usage details for my subscription.

https://blogs.technet.microsoft.com/keithmayer/2015/06/30/export-azure-subscription-usage-to-csv-with-new-billing-api-and-powershell/

"Export Azure Usage via PowerShell using Get-UsageAggregates" (part 1)

I am getting the below error:

Get-UsageAggregates : InvalidInput: Parameter continuationtoken was missing or had an unacceptable value.
At line:30 char:18
+ ... usageData = Get-UsageAggregates -ReportedStartTime $reportedStartTime ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-UsageAggregates], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.UsageAggregates.GetUsageAggregatesCommand

If anyone has worked around this, please let me know how to solve this?


Solution

  • I replaced "" with $null and it seems to be working for the continuationToken.