Azure / Azure/azure-powershell

Get-AzConsumptionPriceSheet is calling an old API-Version

Open Beginner friendly
#15,657 6 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Consumption - Billing Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

## Description

Get-AzConsumptionPriceSheet returns the following error:
"Get-AzConsumptionPriceSheet: Operation returned an invalid status code 'NotFound'"

## Steps to reproduce

Run the following command
```powershell
Get-AzConsumptionPriceSheet
```

## Environment data

```
Name Value
---- -----
PSVersion 7.2.0-preview.8
PSEdition Core
GitCommitId 7.2.0-preview.8
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

```

## Module versions

```powershell
Script 6.2.1 Az
Script 2.5.1 Az.Accounts
Script 2.0.0 Az.Billing
```

## Debug output

```
Get-AzConsumptionPriceSheet -Debug
DEBUG: 11:23:17 PM - GetAzureRmConsumptionPriceSheet begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 11:23:17 PM - using account id 'xxxxxxxxxx'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'xxxxxxxxxx', environment: 'AzureCloud', tenant: 'xxxxxxxxxx'
DEBUG: 11:23:17 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'xxxxxxxxxx', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'xxxxxxxxxx'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17] Found 2 cache accounts and 0 broker accounts
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17] Returning 2 accounts
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] MSAL MSAL.NetCore with assembly version '4.30.1.0'. CorrelationId(6f8e71c3-51a3-4032-96b7-678e0308ff0e)
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] === AcquireTokenSilent Parameters ===
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] LoginHint provided: False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] Account provided: True
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] ForceRefresh: False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 6f8e71c3-51a3-4032-96b7-678e0308ff0e

DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] === Token Acquisition (SilentRequest) started:

Authority Host: login.microsoftonline.com
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] Access token is not expired. Returning the found cache entry. [Current time (08/12/2021 06:23:17) - Expiration Time (08/12/2021 07:15:15 +00:00) - Extended Expiration Time (08/12/2021 07:15:15 +00:00)]
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] Returning access token found in cache. RefreshOn exists ? False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] Fetched access token from host login.microsoftonline.com.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [08/12/2021 06:23:17 - ] === Token Acquisition finished successfully. An access token was returned with Expiration Time: 08/12/2021 07:15:15 +00:00 and Scopes https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2021-08-12T07:15:15.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'xxxxxxxxxx', UserId: 'xxxxxxxxxx'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/xxxxxxxxxx/providers/Microsoft.Consumption/pricesheets/default?$top=1000&api-version=2018-01-31

Headers:
x-ms-client-request-id : 8767aefa-8f2c-4faf-9d1e-e4b56aff88f2
Accept-Language : en-US

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Cache-Control : no-cache
Pragma : no-cache
session-id : f5f0b4a9-75a6-4eb8-812b-e37b8bd5fc97
x-ms-request-id : 0bd5a461-ca41-4cc1-9abd-71d03bb29234
x-ms-correlation-request-id : 470453aa-cfdf-4593-a3ae-087d25ecff2f
x-ms-client-request-id : 8767aefa-8f2c-4faf-9d1e-e4b56aff88f2
OData-Version : 4.0
X-Powered-By : ASP.NET
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-routing-request-id : WESTUS2:20210812T062316Z:470453aa-cfdf-4593-a3ae-087d25ecff2f
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Thu, 12 Aug 2021 06:23:16 GMT

Body:
{
"error": {
"code": "404",
"message": "Cost management data is not supported for subscription(s) xxxxxxxxxx in the provided api-version. Please use api-version 2019-10-01 or later. (Request ID: 0bd5a461-ca41-4cc1-9abd-71d03bb29234)"
}
}

Get-AzConsumptionPriceSheet: Operation returned an invalid status code 'NotFound'

Id :
Name :
PriceSheets : {}
Tag :
Type :

DEBUG: AzureQoSEvent: CommandName - Get-AzConsumptionPriceSheet; IsSuccess - False; Duration - 00:00:00.8579010; Exception - Operation returned an invalid status code 'NotFound';
DEBUG: Finish sending metric.
DEBUG: 11:23:18 PM - GetAzureRmConsumptionPriceSheet end processing.

```

## Error output

```
Get-AzConsumptionPriceSheet
Get-AzConsumptionPriceSheet: Operation returned an invalid status code 'NotFound'

Id :
Name :
PriceSheets : {}
Tag :
Type :
```

Contributor guide

Open the contributing guide

Research direction

Start at the Get-AzConsumptionPriceSheet command implementation and trace the request shown in the debug output, especially its api-version parameter. Reproduce the command, update the request to use the service-supported version, and verify that it no longer returns NotFound for a supported subscription.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
api, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.