I'm using Azure management REST API to get the forecast value for each resource group at the subscription scope. Though I've specified the grouping dimension as ResourceGroup, the response contains the overall forecast for the subscription and not for each resource group. It appears the grouping is not working.
POST request url
https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.CostManagement/forecast?api-version=2019-11-01
Request Body
{
"type": "ActualCost",
"timeframe": "MonthToDate",
"dataSet": {
"granularity": "None",
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"sorting": [
{
"direction": "ascending",
"name": "UsageDate"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ResourceGroupName"
}
],
"filter": {
"Dimensions": {
"Name": "PublisherType",
"Operator": "In",
"Values": [ "azure" ]
}
}
},
"includeActualCost": false,
"includeFreshPartialCost": false
}
Currently in order to get the resource group forecast, I'm making a individual call at the resource group scope which is time consuming since there are hundreds of resource groups