Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.23k stars 3.84k forks source link

Get-AzConsumptionUsageDetail does not honor 'Tag' parameter #8971

Open Oechiih opened 5 years ago

Oechiih commented 5 years ago

Description

Related #8876

When using Get-AzConsumptionUsageDetail with the 'Tag' parameter it is still returning all resources. According to documentation the parameter should be a string value. Digging a little deeper, into the REST API documentation I found out it should be a simple key-value pair separated by a colon i.e. 'key:value'. In the source code of Get-AzConsumptionUsageDetail on line 167 I noted how it handled my input. However the API completely ignores my filter and just returns all my resources instead. As we can see the PS module prepares the request with the filter 'properties/tags eq ' however the API example is using just 'tags'. I tried both variations in Postman and got mixed results:

filter result
tags eq 'dev:tool' Empty array
tags eq ' Array containing all resources
properties/tags eq 'dev:tool' Array containing all resources
properties/tags eq ' Array containing all resources

Steps to reproduce

Get-AzConsumptionUsageDetail -Tag 'dev:tool'

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.0
PSEdition                      Core
GitCommitId                    6.2.0
OS                             Microsoft Windows 10.0.17763
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    Name                                PSEdition ExportedCommands
---------- -------    ----                                --------- ----------------
Script     1.4.0      Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDa…
Script     1.3.1      Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDa…
Script     1.2.1      Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDa…
Script     1.0.1      Az.Aks                              Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential…}
Script     1.0.2      Az.AnalysisServices                 Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServe…
Script     1.0.1      Az.AnalysisServices                 Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServe…
Script     1.0.0      Az.ApiManagement                    Core,Desk {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzAp…
Script     1.0.0      Az.ApplicationInsights              Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzA…
Script     1.2.0      Az.Automation                       Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWork…
Script     1.1.2      Az.Automation                       Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWork…
Script     1.1.1      Az.Automation                       Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWork…
Script     1.1.0      Az.Automation                       Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWork…
Script     1.0.0      Az.Batch                            Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey…
Script     1.0.0      Az.Billing                          Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccou…
Script     0.1.0      Az.Blueprint                        Core,Desk {Get-AzBlueprint, Get-AzBlueprintAssignment, New-AzBlueprintAssig…
Script     1.1.0      Az.Cdn                              Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remo…
Script     1.0.1      Az.Cdn                              Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remo…
Script     1.0.1      Az.CognitiveServices                Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKe…
Script     1.0.0      Az.CognitiveServices                Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKe…
Script     1.6.0      Az.Compute                          Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabil…
Script     1.5.0      Az.Compute                          Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabil…
Script     1.4.0      Az.Compute                          Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabil…
Script     1.2.0      Az.Compute                          Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabil…
Script     1.0.0      Az.ContainerInstance                Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGr…
Script     1.0.1      Az.ContainerRegistry                Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzConta…
Script     1.0.2      Az.DataFactory                      Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2…
Script     1.0.1      Az.DataFactory                      Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2…
Script     1.0.0      Az.DataLakeAnalytics                Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalo…
Script     1.1.0      Az.DataLakeStore                    Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrus…
Script     1.0.2      Az.DataLakeStore                    Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrus…
Script     1.0.0      Az.DevTestLabs                      Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-…
Script     1.0.0      Az.Dns                              Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet…
Script     1.1.0      Az.EventGrid                        Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic…
Script     1.0.1      Az.EventHub                         Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHub…
Script     1.0.0      Az.EventHub                         Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHub…
Script     1.0.0      Az.HDInsight                        Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHD…
Script     1.0.2      Az.IotHub                           Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHub…
Script     1.1.0      Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-Az…
Script     1.0.2      Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-Az…
Script     1.0.1      Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-Az…
Script     1.2.1      Az.LogicApp                         Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssem…
Script     1.2.0      Az.LogicApp                         Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssem…
Script     1.1.0      Az.LogicApp                         Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountCallb…
Script     1.0.0      Az.MachineLearning                  Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, G…
Script     1.0.0      Az.MarketplaceOrdering              Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script     1.0.0      Az.Media                            Core,Desk {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMed…
Script     1.0.1      Az.Monitor                          Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-A…
Script     1.0.0      Az.Monitor                          Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-A…
Script     1.6.0      Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplica…
Script     1.3.0      Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplica…
Script     1.2.1      Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplica…
Script     1.1.0      Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplica…
Script     1.0.0      Az.NotificationHubs                 Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, …
Script     1.1.0      Az.OperationalInsights              Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOpera…
Script     1.0.0      Az.OperationalInsights              Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOpera…
Script     1.0.0      Az.PolicyInsights                   Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, …
Script     1.0.0      Az.PowerBIEmbedded                  Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceColle…
Script     1.2.0      Az.RecoveryServices                 Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVaul…
Script     1.1.0      Az.RecoveryServices                 Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVaul…
Script     1.0.1      Az.RecoveryServices                 Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVaul…
Script     1.0.0      Az.RedisCache                       Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry,…
Script     1.0.0      Az.Relay                            Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace…
Script     1.2.1      Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssi…
Script     1.2.0      Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssi…
Script     1.1.3      Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssi…
Script     1.1.1      Az.Resources                        Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssi…
Script     1.0.0      Az.ServiceBus                       Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServ…
Script     1.0.1      Az.ServiceFabric                    Core,Desk {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricCl…
Script     1.0.2      Az.SignalR                          Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey…
Script     1.7.0      Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTra…
Script     1.5.0      Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTra…
Script     1.4.0      Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTra…
Script     1.3.0      Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTra…
Script     1.1.0      Az.Sql                              Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTra…
Script     1.1.0      Az.Storage                          Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAcco…
Script     1.0.3      Az.Storage                          Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAcco…
Script     1.0.2      Az.Storage                          Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAcco…
Script     1.0.0      Az.StreamAnalytics                  Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunct…
Script     1.0.1      Az.TrafficManager                   Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficMana…
Script     1.1.2      Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan…
Script     1.1.1      Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan…
Script     1.1.0      Az.Websites                         Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan…

Debug output

DEBUG: 13:59:46 - GetAzureRmConsumptionUsageDetail begin processing with ParameterSet 'Subscription'.
DEBUG: 13:59:46 - using account id 
DEBUG: [Common.Authentication]: Authenticating using Account: , environment: 'AzureCloud', tenant: 
DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8283648Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...

DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8307993Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: === Token Acquisition started:
        CacheType: null
        Authentication Target: User
        , Authority Host: login.microsoftonline.com

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:46.8327445Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Loading from cache.

DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8341396Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 3 items to token cache.

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:46.8347726Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Looking up cache for a token...

DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8352557Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: An item matching the requested resource was found in the cache

DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8357250Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: An expired or near expiry token was found in the cache

DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8361758Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:46.8366912Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Refreshing access token...

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.0942602Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Storing token in the cache...

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.0955651Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: An item was stored in the cache

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.0966466Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 09/04/2019 12:59:47 +00:00

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.0974112Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Serializing token cache with 3 items.

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1025804Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1038365Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: === Token Acquisition started:
        CacheType: null
        Authentication Target: User
        , Authority Host: login.microsoftonline.com

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.1047263Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: Loading from cache.

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1055161Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 3 items to token cache.

DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.1060366Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: Looking up cache for a token...

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1065051Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: An item matching the requested resource was found in the cache

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1070403Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: 59,9997827283333 minutes left until token in cache expires

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1074978Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache

DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1080910Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 09/04/2019 12:59:47 +00:00

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<my subscription>/providers/Microsoft.Consumption/usageDetails?$filter=properties%2Ftags eq %27dev%3Atool%27&$top=1000&api-version=2018-01-31

Headers:
x-ms-client-request-id        : a273ab3b-c347-4e12-af87-e651bfafca58
Accept-Language               : en-US

Body:

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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
session-id                    : 2315be1b-e72b-46d9-bf01-22b7d9cdcd41
x-ms-request-id               : c8556bc8-4b09-4ac3-aec5-ebbe8744a568
x-ms-correlation-request-id   : badf3b40-45c3-4ad9-8bd9-cf62a16f0ff6
x-ms-client-request-id        : 367e9115-fb9d-412c-98d1-0a8de405bbb3
OData-Version                 : 4.0
Access-Control-Allow-Origin   : *
X-Content-Type-Options        : nosniff
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-routing-request-id       : UKSOUTH:20190409T115952Z:badf3b40-45c3-4ad9-8bd9-cf62a16f0ff6
Date                          : Tue, 09 Apr 2019 11:59:51 GMT

Body:
{
  "value": [
    {
<Many resources>
    }
  ]
}

DEBUG: AzureQoSEvent: CommandName - Get-AzConsumptionUsageDetail; IsSuccess - True; Duration - 00:00:09.8367261; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 13:59:56 - GetAzureRmConsumptionUsageDetail end processing.
DEBUG: 13:59:56 - GetAzureRmConsumptionUsageDetail end processing.

Error output

No error only unexpected results.

maddieclayton commented 5 years ago

@ms-premp Can you take a look at this issue?

ramaganesan-rg commented 4 years ago

Team is investigating.

HoLengZai commented 4 years ago

I got the same issue. I tried the following commands, nothing works:

$tagFilter = "@{'Owner'='FF'}" $tagFilter = "@{'Owner'=FF}" $tagFilter = "@{Owner='FF'}" $tagFilter = "@{Owner=FF}"

$tagFilter = "@{'Owner':'FF'}" $tagFilter = "@{'Owner':FF}" $tagFilter = "@{Owner:'FF'}" $tagFilter = "@{Owner:FF}"

$tagFilter = "'Owner':'FF'" $tagFilter = "'Owner':FF" $tagFilter = "Owner:'FF'" $tagFilter = "Owner:FF"

$tagFilter = "HelloWorld"

Get-AzConsumptionUsageDetail -BillingPeriodName 202007 -Tag $tagFilter

I got the same result for all the examples above.. no difference, i can put anything, same result. My workaround until this issue is fixed is to parse the variable object Tags returned by "Get-AzConsumptionUsageDetail". So all manual

Btw: I think the right syntax in Powershell should be : "@{'Owner'='FF'}" as when you export with Azure portal, the Azure Tags column appears on JSON format

ramaganesan-rg commented 3 years ago

This one appears to have been fixed. please verify and reopen issue as needed. Thank you for the feedback.

Oechiih commented 3 years ago

Hi @ramaganesan-rg I beg to differ, I tried to get it to work again, trying several options with no luck at all. Even if the issue would have been technically fixed the documentation is still missing. Also it still just returns all resources instead of none when the tag filter is invalid. In my opinion my initially reported issue still stands.

ramaganesan-rg commented 3 years ago

Thanks for chiming in, the team will be looking into it.

From: Jan Oehen notifications@github.com Sent: Friday, October 23, 2020 3:11 AM To: Azure/azure-powershell azure-powershell@noreply.github.com Cc: Rama Ganesan ramagane@microsoft.com; Mention mention@noreply.github.com Subject: Re: [Azure/azure-powershell] Get-AzConsumptionUsageDetail does not honor 'Tag' parameter (#8971)

Hi @ramaganesan-rghttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Framaganesan-rg&data=04%7C01%7Cramagane%40microsoft.com%7C660eb50b798545ee541008d8773bed7f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637390446555857726%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=G3Nk8ITNmT7RztcwvMgtGs8EMkHITzXG8NHdFpiXwek%3D&reserved=0 I beg to differ, I tried to get it to work again, trying several options with no luck at all. Even if the issue would have been technically fixed the documentation is still missing. Also it still just returns all resources instead of none when the tag filter is invalid. In my opinion my initially reported issue still stands.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-powershell%2Fissues%2F8971%23issuecomment-715245012&data=04%7C01%7Cramagane%40microsoft.com%7C660eb50b798545ee541008d8773bed7f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637390446555857726%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JRfbe6iWouuDv4tZ32X2ryUGIzTR3Mh%2FZBCue4culaA%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMK4VB4EQXMQJS2E4GYRTDTSMFJC5ANCNFSM4HERLVAA&data=04%7C01%7Cramagane%40microsoft.com%7C660eb50b798545ee541008d8773bed7f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637390446555867723%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2BlUrkvUq6xzk2iopxQDMOQS4J1iEXdkW4CPUd7jHzPc%3D&reserved=0.

zmustafa commented 3 years ago

I have a workaround:

For example you have: Tag Name: BillingId Tag Value: 123456

The the command to look for the last 30 days consumption would be:

(Get-AzConsumptionUsageDetail -StartDate ([datetime]::Now.AddDays(-30)) -EndDate ([datetime]::Now.AddHours(0))) | Where-Object {$_.Tags -ne $null} | Where-Object {$_.Tags['BillingId'] -eq "123456"}

tadasjuoz commented 3 years ago

It seems that the issue is still there. No key:value pairs are respected by the command.

Also, I tried @zmustafa workaround and it failed too with the following error: $.Tags : The term '$.Tags' is not recognized as the name of a cmdlet, function, script file, or operable program.

Am I using the command wrong somehow?

n-moody commented 3 years ago

It seems that the issue is still there. No key:value pairs are respected by the command.

Also, I tried @zmustafa workaround and it failed too with the following error: $.Tags : The term '$.Tags' is not recognized as the name of a cmdlet, function, script file, or operable program.

Am I using the command wrong somehow?

Add underscores like this: (Get-AzConsumptionUsageDetail -StartDate ([datetime]::Now.AddDays(-30)) -EndDate ([datetime]::Now.AddHours(0))) | Where-Object {$.Tags -ne $null} | Where-Object {$.Tags['tagname'] -eq "tagvalue"}

Oechiih commented 3 years ago

@Barzdaz the underscores following the dollar-signs are not visible here on GitHub. After a pipe you need to use "dollar-underscore" to reference the pipeline variable in PowerShell. @zmustafa Your workaround works fine. But still I feel like either the Parameter needs to be "fixed", properly documented or removed from this CMDLet.

zmustafa commented 3 years ago

It seems that the issue is still there. No key:value pairs are respected by the command.

Also, I tried @zmustafa workaround and it failed too with the following error: $.Tags : The term '$.Tags' is not recognized as the name of a cmdlet, function, script file, or operable program.

Am I using the command wrong somehow?

Updated the original solution with underscores.

MrFly72 commented 3 years ago

I have a workaround:

For example you have: Tag Name: BillingId Tag Value: 123456

The the command to look for the last 30 days consumption would be:

(Get-AzConsumptionUsageDetail -StartDate ([datetime]::Now.AddDays(-30)) -EndDate ([datetime]::Now.AddHours(0))) | Where-Object {$_.Tags -ne $null} | Where-Object {$_.Tags['BillingId'] -eq "123456"}

This one has some disadvantages. It eats memory and cpu if the environment is big enough as it will "get" thousands or even 100thousands of entries, although you might be only searching for 40 entries. So the Tag to work is heavily needed! Especially if you want to handle this in some form of function app, where you want to look at memory usage and cpu usage.

MrFly72 commented 3 years ago

Can someone please reopen this issues? MS Support asked me to ask this here. This problem is not fixed, as the workaround is not ressource-friendly at all and the function for TAGS is just not at all working. Additionally also the Restmethod does not work correctly with tags, as it will only show entries, that have the full tagset delivered, which is nonsense, as nobody might know ALL the tags of the element he wants to find. So at the moment there is only they way to get all data and filter later, which is not sufficient!

ramaganesan-rg commented 3 years ago

Posting on behalf of dev team: Apologies for the delay. The Engineers investigated the issue and found that this issue is due to a bug in our PS SDK. Team has created a backlog item for prioritization in our upcoming sprint planning.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @TiagoCrewGitHubIssues.

Issue Details
## Description Related [#8876](https://github.com/Azure/azure-powershell/issues/8876) When using [Get-AzConsumptionUsageDetail](https://docs.microsoft.com/en-us/powershell/module/az.billing/get-azconsumptionusagedetail?view=azps-1.6.0) with the 'Tag' parameter it is still returning all resources. According to documentation the parameter should be a string value. Digging a little deeper, into the [REST API documentation](https://docs.microsoft.com/en-us/rest/api/consumption/usagedetails/list#uri-parameters) I found out it should be a simple key-value pair separated by a colon i.e. 'key:value'. In the [source code of Get-AzConsumptionUsageDetail](https://github.com/Azure/azure-powershell/blob/master/src/Billing/Consumption/Cmdlets/UsageDetails/GetAzureRmConsumptionUsageDetail.cs) on line 167 I noted how it handled my input. However the API completely ignores my filter and just returns all my resources instead. As we can see the PS module prepares the request with the filter 'properties/tags eq ' however the [API example](https://docs.microsoft.com/en-us/rest/api/consumption/usagedetails/list#usagedetailslistfilterbytag) is using just 'tags'. I tried both variations in Postman and got mixed results: filter | result --- | --- tags eq 'dev:tool' | Empty array tags eq ' | Array containing all resources properties/tags eq 'dev:tool' | Array containing all resources properties/tags eq ' | Array containing all resources - Which is the correct property name declaration? 'properties/tags' or just 'tags' - Is 'Key:Value' the correct format ? - I think it should return no resources if the filter does not match any. ## Steps to reproduce ```powershell Get-AzConsumptionUsageDetail -Tag 'dev:tool' ``` ## Environment data ``` Name Value ---- ----- PSVersion 6.2.0 PSEdition Core GitCommitId 6.2.0 OS Microsoft Windows 10.0.17763 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 ModuleType Version Name PSEdition ExportedCommands ---------- ------- ---- --------- ---------------- Script 1.4.0 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDaΓǪ Script 1.3.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDaΓǪ Script 1.2.1 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDaΓǪ Script 1.0.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredentialΓǪ} Script 1.0.2 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServeΓǪ Script 1.0.1 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServeΓǪ Script 1.0.0 Az.ApiManagement Core,Desk {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApΓǪ Script 1.0.0 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzAΓǪ Script 1.2.0 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkΓǪ Script 1.1.2 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkΓǪ Script 1.1.1 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkΓǪ Script 1.1.0 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkΓǪ Script 1.0.0 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKeyΓǪ Script 1.0.0 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccouΓǪ Script 0.1.0 Az.Blueprint Core,Desk {Get-AzBlueprint, Get-AzBlueprintAssignment, New-AzBlueprintAssigΓǪ Script 1.1.0 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, RemoΓǪ Script 1.0.1 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, RemoΓǪ Script 1.0.1 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKeΓǪ Script 1.0.0 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKeΓǪ Script 1.6.0 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilΓǪ Script 1.5.0 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilΓǪ Script 1.4.0 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilΓǪ Script 1.2.0 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilΓǪ Script 1.0.0 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGrΓǪ Script 1.0.1 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContaΓǪ Script 1.0.2 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2ΓǪ Script 1.0.1 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2ΓǪ Script 1.0.0 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCataloΓǪ Script 1.1.0 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrusΓǪ Script 1.0.2 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrusΓǪ Script 1.0.0 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-ΓǪ Script 1.0.0 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSetΓǪ Script 1.1.0 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopicΓǪ Script 1.0.1 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubΓǪ Script 1.0.0 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubΓǪ Script 1.0.0 Az.HDInsight Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDΓǪ Script 1.0.2 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubΓǪ Script 1.1.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzΓǪ Script 1.0.2 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzΓǪ Script 1.0.1 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzΓǪ Script 1.2.1 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssemΓǪ Script 1.2.0 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssemΓǪ Script 1.1.0 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountCallbΓǪ Script 1.0.0 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, GΓǪ Script 1.0.0 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms} Script 1.0.0 Az.Media Core,Desk {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMedΓǪ Script 1.0.1 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AΓǪ Script 1.0.0 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AΓǪ Script 1.6.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicaΓǪ Script 1.3.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicaΓǪ Script 1.2.1 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicaΓǪ Script 1.1.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicaΓǪ Script 1.0.0 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, ΓǪ Script 1.1.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperaΓǪ Script 1.0.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperaΓǪ Script 1.0.0 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, ΓǪ Script 1.0.0 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceColleΓǪ Script 1.2.0 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVaulΓǪ Script 1.1.0 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVaulΓǪ Script 1.0.1 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVaulΓǪ Script 1.0.0 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry,ΓǪ Script 1.0.0 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespaceΓǪ Script 1.2.1 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssiΓǪ Script 1.2.0 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssiΓǪ Script 1.1.3 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssiΓǪ Script 1.1.1 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssiΓǪ Script 1.0.0 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServΓǪ Script 1.0.1 Az.ServiceFabric Core,Desk {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClΓǪ Script 1.0.2 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKeyΓǪ Script 1.7.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTraΓǪ Script 1.5.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTraΓǪ Script 1.4.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTraΓǪ Script 1.3.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTraΓǪ Script 1.1.0 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTraΓǪ Script 1.1.0 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccoΓǪ Script 1.0.3 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccoΓǪ Script 1.0.2 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccoΓǪ Script 1.0.0 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctΓǪ Script 1.0.1 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManaΓǪ Script 1.1.2 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlanΓǪ Script 1.1.1 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlanΓǪ Script 1.1.0 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlanΓǪ ``` ## Debug output ``` DEBUG: 13:59:46 - GetAzureRmConsumptionUsageDetail begin processing with ParameterSet 'Subscription'. DEBUG: 13:59:46 - using account id DEBUG: [Common.Authentication]: Authenticating using Account: , environment: 'AzureCloud', tenant: DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8283648Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running... DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8307993Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: === Token Acquisition started: CacheType: null Authentication Target: User , Authority Host: login.microsoftonline.com DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:46.8327445Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Loading from cache. DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8341396Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 3 items to token cache. DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:46.8347726Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Looking up cache for a token... DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8352557Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: An item matching the requested resource was found in the cache DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8357250Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: An expired or near expiry token was found in the cache DEBUG: [ADAL]: Information: 2019-04-09T11:59:46.8361758Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:46.8366912Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Refreshing access token... DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.0942602Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: Storing token in the cache... DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.0955651Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: An item was stored in the cache DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.0966466Z: 641b5c3f-2f56-4cc9-a231-5490cf7ab57c - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 09/04/2019 12:59:47 +00:00 DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.0974112Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Serializing token cache with 3 items. DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1025804Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: ADAL PCL.CoreCLR with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running... DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1038365Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: === Token Acquisition started: CacheType: null Authentication Target: User , Authority Host: login.microsoftonline.com DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.1047263Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: Loading from cache. DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1055161Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 3 items to token cache. DEBUG: [ADAL]: Verbose: 2019-04-09T11:59:47.1060366Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: Looking up cache for a token... DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1065051Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: An item matching the requested resource was found in the cache DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1070403Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: 59,9997827283333 minutes left until token in cache expires DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1074978Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache DEBUG: [ADAL]: Information: 2019-04-09T11:59:47.1080910Z: 34dab5d9-eee3-4c63-b536-173555fb91ba - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 09/04/2019 12:59:47 +00:00 DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: GET Absolute Uri: https://management.azure.com/subscriptions//providers/Microsoft.Consumption/usageDetails?$filter=properties%2Ftags eq %27dev%3Atool%27&$top=1000&api-version=2018-01-31 Headers: x-ms-client-request-id : a273ab3b-c347-4e12-af87-e651bfafca58 Accept-Language : en-US Body: DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK Headers: Cache-Control : no-cache Pragma : no-cache session-id : 2315be1b-e72b-46d9-bf01-22b7d9cdcd41 x-ms-request-id : c8556bc8-4b09-4ac3-aec5-ebbe8744a568 x-ms-correlation-request-id : badf3b40-45c3-4ad9-8bd9-cf62a16f0ff6 x-ms-client-request-id : 367e9115-fb9d-412c-98d1-0a8de405bbb3 OData-Version : 4.0 Access-Control-Allow-Origin : * X-Content-Type-Options : nosniff Strict-Transport-Security : max-age=31536000; includeSubDomains x-ms-ratelimit-remaining-subscription-reads: 11999 x-ms-routing-request-id : UKSOUTH:20190409T115952Z:badf3b40-45c3-4ad9-8bd9-cf62a16f0ff6 Date : Tue, 09 Apr 2019 11:59:51 GMT Body: { "value": [ { } ] } DEBUG: AzureQoSEvent: CommandName - Get-AzConsumptionUsageDetail; IsSuccess - True; Duration - 00:00:09.8367261; Exception - ; DEBUG: Finish sending metric. DEBUG: 13:59:56 - GetAzureRmConsumptionUsageDetail end processing. DEBUG: 13:59:56 - GetAzureRmConsumptionUsageDetail end processing. ``` ## Error output No error only unexpected results.
Author: Oechiih
Assignees: ms-premp
Labels: `Consumption`, `Consumption-UsageDetailsandExport`, `Service Attention`, `bug`, `customer-reported`
Milestone: -
adwise3 commented 3 years ago

Our apologies for the continued delay. We are triaging this will provide an update once we have more information.

MrFly72 commented 3 years ago

Please also look at the query speed when date is limited. It looks to me that querying is not the most effective way for performance.

TiagoCrewGitHubIssues commented 2 years ago

we still have this in our backlog and have started the design for this. We'll keep this issue updated

tujamg commented 2 years ago

we still have this in our backlog and have started the design for this. We'll keep this updated.

navba-MSFT commented 2 years ago

@Oechiih Apologies for the late reply. As mentioned by @tujamg, we will update this thread once this issue is addressed.