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

Get-AzureRmConsumptionUsageDetail missing page results

Open gvee-uk opened this issue 8 years ago • 12 comments

Description

Larger result requests using Get-AzureRmConsumptionUsageDetail do not correlate with what's presented in the Azure Portal.

Script/Steps for Reproduction

[datetime]$StartDate = Get-Date -Date "2017-07-01"
[datetime]$EndDate   = Get-Date -Date "2017-07-31"
$consumptionDetails = Get-AzureRmConsumptionUsageDetail -StartDate $StartDate -EndDate $EndDate -IncludeMeterDetails
$consumptionDetails | Select-Object UsageStart -Unique | Sort-Object
UsageStart         
----------         
31/07/2017 00:00:00
03/07/2017 00:00:00
04/07/2017 00:00:00
05/07/2017 00:00:00
06/07/2017 00:00:00
07/07/2017 00:00:00
08/07/2017 00:00:00
09/07/2017 00:00:00
10/07/2017 00:00:00
11/07/2017 00:00:00
12/07/2017 00:00:00
13/07/2017 00:00:00
14/07/2017 00:00:00
15/07/2017 00:00:00
16/07/2017 00:00:00
17/07/2017 00:00:00
18/07/2017 00:00:00
19/07/2017 00:00:00
25/07/2017 00:00:00
26/07/2017 00:00:00
27/07/2017 00:00:00
28/07/2017 00:00:00
29/07/2017 00:00:00
30/07/2017 00:00:00
02/07/2017 00:00:00
01/07/2017 00:00:00

Note the gaps in dates e.g. 20-24th inclusive. These dates can be requested individually.

Module Version

Get-Module -Name AzureRM -ListAvailable
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.3.0      AzureRM
Script     5.1.1      AzureRM
Get-Module AzureRM.Consumption
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   0.3.0      AzureRM.Consumption                 Get-AzureRmConsumptionUsageDetail

Environment Data

$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.16299.98
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.98
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Debug Output

The results of running with debug are extremely large, so I have stripped it back to the first few HTTP requests and responses to highlight the issue. Please let me know if you require more and I can go through and sanitise the whole file so it is shareable.

============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/%2Fsubscriptions%2F<SubscriptionId>/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails%2CadditionalProperties&$filter=usageEnd ge 2017-07-01T23:59:59Z and usageEnd le 
2017-07-31T23:59:59Z&api-version=2017-04-24-preview

Headers:
x-ms-client-request-id        : 01ea6f16-47bb-4b66-8f26-a08dc149e30c
accept-language               : en-US

Body:



============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 14999
x-ms-request-id               : 99fd2f4f-0e5e-4d94-9927-bb40a68c01c0
x-ms-correlation-request-id   : 99fd2f4f-0e5e-4d94-9927-bb40a68c01c0
x-ms-routing-request-id       : UKSOUTH:20180223T121817Z:99fd2f4f-0e5e-4d94-9927-bb40a68c01c0
Cache-Control                 : no-cache
Date                          : Fri, 23 Feb 2018 12:18:17 GMT
Server                        : Microsoft-IIS/8.5
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "value": [
...
  ],
  "nextLink": "https://management.azure.com/subscriptions/<SubscriptionId>/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails,additionalProperties&$filter=usageEnd%20ge%202017-07-01T23:59:59Z%20and%20usageEnd%2
0le%202017-07-31T23:59:59Z&api-version=2017-04-24-preview&$skiptoken=MCMjMSMjMCMjOCMj"
}
============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/%2Fsubscriptions%2F<SubscriptionId>/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails%2CadditionalProperties&$filter=usageEnd ge 2017-07-01T23:59:59Z and usageEnd le 
2017-07-31T23:59:59Z&$skiptoken=`&api-version=2017-04-24-preview

Headers:
x-ms-client-request-id        : 20114a17-7bbc-4d43-9bbc-dc7a9d3d4202
accept-language               : en-US

Body:



============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 14998
x-ms-request-id               : 7056c06c-d992-4b00-a316-e8c3adb09d8f
x-ms-correlation-request-id   : 7056c06c-d992-4b00-a316-e8c3adb09d8f
x-ms-routing-request-id       : UKSOUTH:20180223T121827Z:7056c06c-d992-4b00-a316-e8c3adb09d8f
Cache-Control                 : no-cache
Date                          : Fri, 23 Feb 2018 12:18:27 GMT
Server                        : Microsoft-IIS/8.5
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "value": [
...
  ],
  "nextLink": "https://management.azure.com/subscriptions/<SubscriptionId>/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails,additionalProperties&$filter=usageEnd%20ge%202017-07-01T23:59:59Z%20and%20usageEnd%2
0le%202017-07-31T23:59:59Z&api-version=2017-04-24-preview&$skiptoken=MjAxNzA5IyMxIyMxMDAwIyM4IyM%3D"
}
============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/%2Fsubscriptions%2F<SubscriptionId>/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails%2CadditionalProperties&$filter=usageEnd ge 2017-07-01T23:59:59Z and usageEnd le 
2017-07-31T23:59:59Z&$skiptoken=MjAxNzA5IyMxIyMxMDAwIyM4IyM%3D&api-version=2017-04-24-preview

Headers:
x-ms-client-request-id        : 71e37604-7c42-4a48-b930-7b0fcb2944ff
accept-language               : en-US

Body:



============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 14997
x-ms-request-id               : 9dac60a0-0e23-446a-b9a7-a0afb8a39764
x-ms-correlation-request-id   : 9dac60a0-0e23-446a-b9a7-a0afb8a39764
x-ms-routing-request-id       : UKSOUTH:20180223T121837Z:9dac60a0-0e23-446a-b9a7-a0afb8a39764
Cache-Control                 : no-cache
Date                          : Fri, 23 Feb 2018 12:18:36 GMT
Server                        : Microsoft-IIS/8.5
X-AspNet-Version              : 4.0.30319
X-Powered-By                  : ASP.NET

Body:
{
  "value": [
...
  ],
  "nextLink": "https://management.azure.com/subscriptions/<SubscriptionId>/providers/Microsoft.Consumption/usageDetails?$expand=meterDetails,additionalProperties&$filter=usageEnd%20ge%202017-07-01T23:59:59Z%20and%20usageEnd%2
0le%202017-07-31T23:59:59Z&api-version=2017-04-24-preview&$skiptoken=MjAxNzA5IyMxIyMyMDAwIyM4IyM%3D"
}

Pay special attention to the value of nextLink and $skiptoken throughout.

gvee-uk avatar Feb 26 '18 07:02 gvee-uk

@Panda-Wang Hey Panda, would you mind taking a look at this issue?

cormacpayne avatar Feb 26 '18 16:02 cormacpayne

@cormacpayne @Panda-Wang any movement on this one?

gvee-uk avatar Mar 12 '18 09:03 gvee-uk

@cormacpayne @Panda-Wang any chance of an update on this, please? It's been over 3 weeks without any feedback.

gvee-uk avatar Mar 21 '18 07:03 gvee-uk

@cormacpayne @Panda-Wang 👋

gvee-uk avatar Mar 26 '18 09:03 gvee-uk

@wilcobmsft Hey Wilco, would you mind taking a look at this issue?

cormacpayne avatar Mar 26 '18 21:03 cormacpayne

@cormacpayne @wilcobmsft 👋 Any update on this, this week?

gvee-uk avatar Apr 05 '18 22:04 gvee-uk

@cormacpayne @wilcobmsft 👈 a weekly nudge for a progress update 👋 Having no communication isn't fun. Throw me a bone here!

Our internal work on this is still blocked by this bug but is appearing on the horizon again so I would like to let the PO know if we should wait for a resolution to this issue or look in to other alternative solutions?

gvee-uk avatar Apr 13 '18 07:04 gvee-uk

@ms-premp Can you please take a look?

wilcobmsft avatar Apr 13 '18 19:04 wilcobmsft

Hi @gvee-uk .. apologies for delay in response here. We will have a resolution by end of April, 2018.

ms-premp avatar Apr 13 '18 19:04 ms-premp

Hi @ms-premp - how are you getting along with this?

gvee-uk avatar Apr 30 '18 08:04 gvee-uk

Hi @gvee-uk, due to unforeseen reasons we are pushing this to end of May. I will update this conversation as soon as this is released.

ms-premp avatar May 06 '18 19:05 ms-premp

We have the latest cmdlet Get-AzureRmConsumptionUsageDetail based on API version 2018-01-31. Please refer to the pull request just merged. https://github.com/Azure/azure-powershell/pull/6023 Will close the issue.

bgsky avatar May 08 '18 23:05 bgsky