Get-AzConsumptionUsageDetail delivers different Results
I run the same query 3 times against the API and store the Result into a SQL-Database. With each run of the exact same Script, I get a different result:

My Code:
$Date = (Get-Date).AddDays(-1).ToString("yyyy-MM-dd")
$AllSubs = Get-AzSubscription
$AllItems = $AllSubs | ForEach-Object -ThrottleLimit 3 -Parallel {
Set-AzContext $_.Name
$Items = Get-AzConsumptionUsageDetail -StartDate $using:Date -EndDate $using:Date -IncludeAdditionalProperties -IncludeMeterDetails
return $Items
}
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @amberbhargava, @shilpigautam, @ramaganesan-rg, @anand-rengasamy.
Issue Details
I run the same query 3 times against the API and store the Result into a SQL-Database. With each run of the exact same Script, I get a different result:

My Code:
$Date = (Get-Date).AddDays(-1).ToString("yyyy-MM-dd")
$AllSubs = Get-AzSubscription
$AllItems = $AllSubs | ForEach-Object -ThrottleLimit 3 -Parallel {
Set-AzContext $_.Name
$Items = Get-AzConsumptionUsageDetail -StartDate $using:Date -EndDate $using:Date -IncludeAdditionalProperties -IncludeMeterDetails
return $Items
}
| Author: | Gill-Bates |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
@Gill-Bates , could you share the debug message? It can be turn on via $DebugPreference = "Continue"
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ms-premp, @ramaganesan-rg.
Issue Details
I run the same query 3 times against the API and store the Result into a SQL-Database. With each run of the exact same Script, I get a different result:

My Code:
$Date = (Get-Date).AddDays(-1).ToString("yyyy-MM-dd")
$AllSubs = Get-AzSubscription
$AllItems = $AllSubs | ForEach-Object -ThrottleLimit 3 -Parallel {
Set-AzContext $_.Name
$Items = Get-AzConsumptionUsageDetail -StartDate $using:Date -EndDate $using:Date -IncludeAdditionalProperties -IncludeMeterDetails
return $Items
}
| Author: | Gill-Bates |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
@adwise3 can you pls route this issue as needed and provide a response.
@Gill-Bates are you running the query for costs during the open month? Those can change up until the invoice is cut. Please see this document for more information on usage data in Cost Management.
https://docs.microsoft.com/en-us/azure/cost-management-billing/costs/understand-cost-mgt-data#cost-and-usage-data-updates-and-retention
@adwise3 I fired the query several times within a few minutes on the same resources.
Summarized again: If I run the query as a ForEach-Object, I always get the same (expected) result. If I run it as ForEach-Object -Parallel, the result varies. I will add detailed information to my initial post.
@Gill-Bates as Adam mentioned looks like you are querying the cost during open month, and those are expected to change if there is any usage in azure.
Let us know if you have any more questions.