Azure / Azure/azure-rest-api-specs
[BUG] CostManagement - grouping by ConsumedService not working
Nobody has claimed this yet.
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 6k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 432
Description
API Spec link
API Spec version
2025-03-01
Describe the bug
We were regularly using POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2019-01-01 on subscriptions scope to get cost details for several years without any issues.
After 25th of June this year API calls started failing with Error message:
BadRequest","message":"Invalid query definition: Invalid dataset grouping: 'ConsumedService'
We tried to bump API version to 2025-03-01 but behavior is the same.
Expected behavior
Call POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2025-03-01 on subscriptions scope with grouping on ConsumedService succeeded
Actual behavior
Call POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/query?api-version=2025-03-01 on subscriptions scope with grouping on ConsumedService fails with:
Error message:
BadRequest","message":"Invalid query definition: Invalid dataset grouping: 'ConsumedService'; valid values:
'ResourceGroup','ResourceGroupName','ResourceType','ResourceId','ResourceLocation','SubscriptionId','SubscriptionName','MeterCategory','MeterSubcategory','Meter','ServiceFamily','UnitOfMeasure','PartNumber','BillingAccountName','BillingProfileId','BillingProfileName','InvoiceSection','InvoiceSectionId','InvoiceSectionName','Product','ResourceGuid','ChargeType','ServiceName','ProductOrderId','ProductOrderName','PublisherType','ReservationId','ReservationName','Frequency','InvoiceId','PricingModel','CostAllocationRuleName','MarkupRuleName','BillingMonth','Provider','BenefitId','BenefitName','CustomerTenantId','CustomerTenantDomainName','ResellerMPNId','PartnerEarnedCreditApplied','CustomerName','PartnerName'
Reproduction Steps
You can use: https://learn.microsoft.com/en-us/rest/api/cost-management/query/usage?view=rest-cost-management-2025-03-01&tabs=HTTP&tryIt=true&source=docs#code-try-0 to test it.
{
"dataSet": {
"granularity": "Daily",
"sorting": [
{
"direction": "ascending",
"name": "UsageDate"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ResourceId"
},
{
"type": "Dimension",
"name": "ResourceType"
},
{
"type": "Dimension",
"name": "ResourceGroupName"
},
{
"type": "Dimension",
"name": "ConsumedService"
}
]
},
"timeframe": "Custom",
"timePeriod": {
"from": "2025-07-21T00:00:00+00:00",
"to": "2025-07-21T23:59:59+00:00"
},
"type": "ActualCost"
}
Environment
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the API specification under specification/cost-management/resource-manager/Microsoft.CostManagement/stable and inspect the 2025-03-01 definition for supported dataset grouping dimensions. Reproduce the subscription-scope POST query using the provided endpoint and payload, then compare the specification with the service response. Done should establish whether ConsumedService is missing from the spec or whether the backend behavior must be addressed elsewhere.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, openapi
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100