Azure Cost Management - Usage query configuration ignored

Kjellson Emelie (Ext) 1 Reputation point
2022-11-03T14:03:20.573+00:00

I have the same issue as is described in this question on StackOverflow (only answered with a less preferred workaround). I am performing a query of Usage to the Cost Management API, version 2021-10-01. Through the configuration property in the request body I am supposed to be able to select columns. But whichever column I enter, out of all the possible values, all I get in return is "UsageDate" and "Currency". How do I get any other column?

Example request body:

{  
    "Type": "Usage",  
    "Timeframe": "MonthToDate",  
    "TimePeriod": null,  
    "Dataset": {  
        "Granularity": "Daily",  
        "Configuration": {  
            "Columns": [  
                "DepartmentName",  
                "AccountName",  
                "AccountOwnerId",  
                "SubscriptionGuid",  
                "SubscriptionName",  
                "ResourceGroup",  
                "ResourceLocation",  
                "UsageDateTime",  
                "ProductName",  
                "MeterCategory",  
                "MeterSubcategory",  
                "MeterId",  
                "MeterName",  
                "MeterRegion",  
                "UnitOfMeasure",  
                "UsageQuantity",  
                "ResourceRate",  
                "PreTaxCost",  
                "CostCenter",  
                "ConsumedService",  
                "ResourceType",  
                "InstanceId",  
                "Tags",  
                "OfferId",  
                "AdditionalInfo",  
                "ServiceInfo1",  
                "ServiceInfo2"  
            ]  
        },  
        "Aggregation": null,  
        "Grouping": null,  
        "Filter": null  
    }  
}  

Response body:

{  
    "id": "subscriptions/XXXXXXXXXXXXXX/providers/Microsoft.CostManagement/query/XXXXXXXXXXXXX",  
    "name": "XXXXXXXXXX",  
    "type": "Microsoft.CostManagement/query",  
    "location": null,  
    "sku": null,  
    "eTag": null,  
    "properties": {  
        "nextLink": null,  
        "columns": [  
            {  
                "name": "UsageDate",  
                "type": "Number"  
            },  
            {  
                "name": "Currency",  
                "type": "String"  
            }  
        ],  
        "rows": [  
            [  
                20221101,  
                "EUR"  
            ],  
            [  
                20221102,  
                "EUR"  
            ]  
        ]  
    }  
}  
Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,034 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 37,686 Reputation points Microsoft Employee
    2022-11-08T10:13:13.877+00:00

    @Kjellson Emelie (Ext) Thank you for contacting us and I apologize for delayed response!

    I understand that you are using query of usage through configuration property and not getting expected results. We highly recommend you not to use configuration. Use Grouping instead. Because we are planning remove the configuration attribute from Swagger for Query as it isn't worked as expected.

    Note you can only group by 10 columns. If you need more, please use Exports or Cost Details.

    ----------------------------------------------------------------------------------------------------------------------

    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments