Skip to content

Invoke-AzCostManagementQuery delivers empty result #20749

Open
@Gill-Bates

Description

@Gill-Bates

Description

When I run

Invoke-AzCostManagementQuery -Scope "/subscriptions/xxxx-xxxx-xxx-xxx-xxxx" -Timeframe 'TheLastMonth' -Type Usage -DatasetGranularity 'Daily'

for a Subscription which is Part of an Enterprise Agreement I receive an empty result. I have Cost Administrator Privelges. Any idea?

Issue script & Debug output

DEBUG: 17:13:00 - InvokeAzRestMethodCommand begin processing with ParameterSet 'ByPath'.
DEBUG: 17:13:00 - using account id 'xxx@xxx'...
DEBUG: 17:13:00 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'xxxx', environment: 'AzureCloud', tenant: 'xxxx'
DEBUG: 17:13:00 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'xxxx', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'xxxx'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 51988fec-0027-4f90-ada9-6ac2b8b21318] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z] [WamBroker] WAM supported OS.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z] [WamBroker] ListWindowsWorkAndSchoolAccounts option was not enabled.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 7ba0ba12-5684-415a-a7d7-46f72f531f68] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z] Found 4 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z] Returning 4 accounts
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] MSAL MSAL.NetCore with assembly version '4.49.1.0'. CorrelationId(6d01bafb-6d02-4a73-b631-91bc347a55c2)
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] LoginHint provided: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] Account provided: True
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] ForceRefresh: False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2]
=== 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 - True
HomeAccountId - False
CorrelationId - 6d01bafb-6d02-4a73-b631-91bc347a55c2
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] Access token is not expired. Returning the found cache entry. [Current time (01/26/2023 16:13:00) - Expiration Time (01/26/2023 16:36:35 +00:00) - Extended Expiration Time (01/26/2023 16:36:35 +00:00)]
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2]
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.49.1.0 MSAL.NetCore .NET 6.0.3 Microsoft Windows 10.0.19044 [2023-01-26 16:13:00Z - 6d01bafb-6d02-4a73-b631-91bc347a55c2]  AT expiration time: 26.01.2023 16:36:35 +00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2023-01-26T16:36:35.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'xxx', UserId: 'xxxx'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.azure.com/subscriptions/xxxx/providers/Microsoft.CostManagement/query?api-version=2019-11-01

Headers:
x-ms-client-request-id        : f9438e95-bee4-4db3-9e66-a5ec21f7b60d
Accept-Language               : en-US

Body:
{
  "dataset": {
    "granularity": "Daily"
  },
  "type": "Usage",
  "timeframe": "TheLastMonth"
}


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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Vary                          : Accept-Encoding
session-id                    : 51c2a488-47ab-487f-99d0-7358f9a52d5a
x-ms-request-id               : 9951e541-e573-4789-bd8d-89b3225ef214
x-ms-correlation-request-id   : 3045594b-721a-44e5-83a0-8a2505ec4307
x-ms-client-request-id        : f9438e95-bee4-4db3-9e66-a5ec21f7b60d
x-ms-ratelimit-remaining-microsoft.costmanagement-entity-requests: DefaultQuota:7
x-ms-ratelimit-remaining-microsoft.costmanagement-tenant-requests: DefaultQuota:49
x-ms-ratelimit-microsoft.costmanagement-qpu-consumed: 1
x-ms-ratelimit-microsoft.costmanagement-qpu-remaining: QueriesPerHour:590,QueriesPerMin:59,QueriesPer10Sec:11
X-Powered-By                  : ASP.NET
x-ms-ratelimit-remaining-subscription-resource-requests: 99
x-ms-routing-request-id       : FRANCESOUTH:20230126T161303Z:3045594b-721a-44e5-83a0-8a2505ec4307
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Thu, 26 Jan 2023 16:13:03 GMT

Body:
{
  "id": "subscriptions/xxxxx/providers/Microsoft.CostManagement/query/5e22df21-03a8-419b-9a35-d084dc9041c1",
  "name": "5e22df21-03a8-419b-9a35-d084dc9041c1",
  "type": "Microsoft.CostManagement/query",
  "location": null,
  "sku": null,
  "eTag": null,
  "properties": {
    "nextLink": null,
    "columns": [
      {
        "name": "UsageDate",
        "type": "Number"
      },
      {
        "name": "Currency",
        "type": "String"
      }
    ],
    "rows": []
  }
}


DEBUG: 17:13:03 - InvokeAzRestMethodCommand end processing.


DEBUG: AzureQoSEvent:  Module: Az.CostManagement:0.3.0; CommandName: Invoke-AzCostManagementQuery; PSVersion: 7.2.2; IsSuccess: True; Duration: 00:00:03.3734948

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.2
PSEdition                      Core
GitCommitId                    7.2.2
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     0.3.0                 Az.CostManagement                   {Get-AzCostManagementExport, Get-AzCostManagementExportExecutionHistory, Invoke-AzCostManagementExecuteExport, Invoke-AzCostManagement

Error output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Cost Management - QueryAll issues in cost management and Consumption for query API associated to tags, dimensions and forecService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions