Azure / Azure/azure-powershell
Get-AzConsumptionPriceSheet error
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
When I run `$pricesheet = Get-AzConsumptionPriceSheet` , I expect the result to be stored in $pricesheet, however I'm getting a BadRequest error after a very long wait.
### Issue script & Debug output
```PowerShell
{
"billingPeriodId": "/subscriptions//providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "79bdd7ac-897c-5638-a80d-6c2521c57289",
"unitOfMeasure": "1 /Day",
"includedQuantity": 0.0,
"partNumber": "AAD-95756",
"unitPrice": $$$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "1000 GB Commitment Tier Capacity Reservation",
"meterCategory": "Sentinel",
"unit": "1 /Day",
"meterLocation": "AP Southeast",
"meterSubCategory": ""
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "dde03a0b-8fee-57f8-a820-30361204679f",
"unitOfMeasure": "1 /Month",
"includedQuantity": 0.0,
"partNumber": "AAL-30008",
"unitPrice": $$$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "P60 - Special LRS Disk",
"meterCategory": "Storage",
"unit": "1 /Month",
"meterLocation": "NO West",
"meterSubCategory": "Premium SSD Managed Disks"
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "bbe538c2-d8ae-4d22-b902-3eb1fbb57403",
"unitOfMeasure": "1 /Month",
"includedQuantity": 0.0,
"partNumber": "AAD-55796",
"unitPrice": $$$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "E70 Disks",
"meterCategory": "Storage",
"unit": "1 /Month",
"meterLocation": "KR South",
"meterSubCategory": "Standard SSD Managed Disks"
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "de05693f-4a15-412c-8aa6-450b72447f2c",
"unitOfMeasure": "10000 Hours",
"includedQuantity": 0.0,
"partNumber": "AAD-34553",
"unitPrice": $$$$.$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "vCore",
"meterCategory": "SQL Database",
"unit": "10000 Hours",
"meterLocation": "EU North",
"meterSubCategory": "SingleDB Hyperscale - Compute Gen5"
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "95ab3e29-bcd9-4000-a89a-3eb9930cfef6",
"unitOfMeasure": "10000 Hours",
"includedQuantity": 0.0,
"partNumber": "AAD-34624",
"unitPrice": $$$$.$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "vCore",
"meterCategory": "SQL Database",
"unit": "10000 Hours",
"meterLocation": "AP East",
"meterSubCategory": "SingleDB Hyperscale - Compute Gen4"
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "b50c81d5-b280-50b0-9c14-5ea0498bcc2e",
"unitOfMeasure": "1 /Month",
"includedQuantity": 0.0,
"partNumber": "AAM-87868",
"unitPrice": $$$$.$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "Commitment Tier Pre-Built Azure 500K Unit",
"meterCategory": "Azure Applied AI Services",
"unit": "1 /Month",
"meterLocation": "",
"meterSubCategory": "Azure Form Recognizer"
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "bb8c6104-f16c-4078-b9ce-04009f40c47a",
"unitOfMeasure": "10000 Hours",
"includedQuantity": 0.0,
"partNumber": "AAD-74022",
"unitPrice": $$$$.$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "vCore",
"meterCategory": "SQL Database",
"unit": "10000 Hours",
"meterLocation": "NO West",
"meterSubCategory": "Single General Purpose - Serverless - Compute Gen4"
}
},
{
"billingPeriodId": "/subscriptions/*/providers/Microsoft.Billing/billingPeriods/20230101",
"meterId": "5fab2cbc-cf3a-5be4-a750-e54aaabd07a8",
"unitOfMeasure": "1 /Day",
"includedQuantity": 0.0,
"partNumber": "AAG-30021",
"unitPrice": $$$$$.$$,
"currencyCode": "EUR",
"meterDetails": {
"meterName": "5000 GB Commitment Tier Capacity Reservation",
"meterCategory": "Azure Monitor",
"unit": "1 /Day",
"meterLocation": "BR South",
"meterSubCategory": ""
}
}
]
}
}
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/*/providers/Microsoft.Billing/billingPeriods/202301/providers/Microsoft.Consumption/pricesheets/default?$expand=properties%2FmeterDetails&$skiptoken=%252BAAAAA%253D%25&$top=1000&api-version=2018-01-31
Headers:
x-ms-client-request-id : 72e5a9e0-3370-4a77-90bd-057d83f6769d
Accept-Language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Cache-Control : no-cache
Pragma : no-cache
session-id : c1407cfa-2fce-4ec1-bd43-fe48cfc273d3
x-ms-request-id : 4eecc286-b626-4ff2-b605-eb2d64ade283
x-ms-correlation-request-id : 693f3245-02ef-4ce6-ba3d-04b440c53b30
x-ms-client-request-id : 72e5a9e0-3370-4a77-90bd-057d83f6769d
x-ms-ratelimit-armPricesheets-retry-after: 60
x-ms-ratelimit-remaining-armPricesheets-requests: 998
x-ms-ratelimit-armPricesheets_[subscriptionID]-retry-after: 60
x-ms-ratelimit-remaining-armPricesheets_[SubscriptionID]-requests: 189
OData-Version : 4.0
X-Powered-By : ASP.NET
x-ms-ratelimit-remaining-subscription-reads: 11751
x-ms-routing-request-id : FRANCECENTRAL:20230119T121155Z:693f3245-02ef-4ce6-ba3d-04b440c53b30
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Thu, 19 Jan 2023 12:11:54 GMT
Body:
{
"error": {
"code": "400",
"message": "Invalid skip token provided. (Request ID: 4eecc286-b626-4ff2-b605-eb2d64ade283)"
}
}
DEBUG: 13:11:55 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Get-AzConsumptionPriceSheet: Operation returned an invalid status code 'BadRequest'
DEBUG: 13:12:13 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Billing:2.0.0; CommandName: Get-AzConsumptionPriceSheet; PSVersion: 7.2.7; IsSuccess: False; Duration: 00:15:54.7216159; Exception: Operation returned an invalid status code 'BadRequest';
DEBUG: 13:12:13 - GetAzureRmConsumptionPriceSheet end processing.
```
### Environment data
```PowerShell
Name Value
---- -----
PSVersion 7.2.7
PSEdition Core
GitCommitId 7.2.7
OS Darwin 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.10.4 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 2.0.0 Az.Billing {Get-AzBillingAccount, Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzBillingProfile…}
```
### Error output
```PowerShell
Message : Operation returned an invalid status code 'BadRequest'
StackTrace : at Microsoft.Azure.Management.Consumption.PriceSheetOperations.GetWithHttpMessagesAsync(String expand, String skiptoken, Nullable`1 top, Dictionary`2 customHeaders, CancellationToken
cancellationToken)
at Microsoft.Azure.Management.Consumption.PriceSheetOperationsExtensions.GetAsync(IPriceSheetOperations operations, String expand, String skiptoken, Nullable`1 top, CancellationToken
cancellationToken)
at Microsoft.Azure.Management.Consumption.PriceSheetOperationsExtensions.Get(IPriceSheetOperations operations, String expand, String skiptoken, Nullable`1 top)
at Microsoft.Azure.Commands.Consumption.Cmdlets.GetAzureRmConsumptionPriceSheet.ExecuteCmdlet()
Exception : Microsoft.Azure.Management.Consumption.Models.ErrorResponseException
InvocationInfo : {Get-AzConsumptionPriceSheet}
Line : $pricesheet = Get-AzConsumptionPriceSheet
Position : At line:1 char:15
+ $pricesheet = Get-AzConsumptionPriceSheet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 8
```
Contributor guide
Research direction
Start by reproducing Get-AzConsumptionPriceSheet and inspect the generated Microsoft.Consumption price-sheet request, especially the skiptoken shown in the debug output. Trace the cmdlet through Microsoft.Azure.Management.Consumption.PriceSheetOperations and verify that the command returns the price sheet successfully without an Invalid skip token BadRequest.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100