azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzConsumptionUsageDetail delivers different Results

Open Gill-Bates opened this issue 5 years ago • 7 comments

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:

image

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
}

Gill-Bates avatar Apr 21 '21 09:04 Gill-Bates

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:

image

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:

Billing, Service Attention, customer-reported, needs-triage, question

Milestone: -

ghost avatar Apr 22 '21 00:04 ghost

@Gill-Bates , could you share the debug message? It can be turn on via $DebugPreference = "Continue"

dingmeng-xue avatar Apr 22 '21 00:04 dingmeng-xue

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:

image

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:

Cost Management, Service Attention, customer-reported, question

Milestone: -

ghost avatar Jun 08 '21 21:06 ghost

@adwise3 can you pls route this issue as needed and provide a response.

ShilpiGautam avatar Jun 15 '21 23:06 ShilpiGautam

@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 avatar Jun 16 '21 16:06 adwise3

@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 avatar Jun 17 '21 10:06 Gill-Bates

@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.

Lira-tron avatar Jun 17 '21 17:06 Lira-tron