Azure / Azure/azure-rest-api-specs
[Microsoft.CostManagement/views] MetricType "AmortizedCost" not working
- Dominant language
- TypeSpec
- Stars
- 3.1k
- Forks
- 5.9k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 444
Description
Hello,
I have been trying to deploy CostManagement views using API Rest.
According to [documentation](https://learn.microsoft.com/en-us/rest/api/cost-management/views/create-or-update-by-scope?tabs=HTTP&tryIt=true&source=docs#request-body) properties.metric allows 3 values : AHUB, ActualCost or AmortizedCost.
I have been trying to use "AmortizedCost" as shown in the following request.
```json
{
"id": "/subscriptions/xxx/providers/Microsoft.CostManagement/views/Test",
"name": "Test",
"type": "Microsoft.CostManagement/Views",
"eTag": "\"1d9f21459e0b3cd\"",
"properties": {
"displayName": "TMP-View-4",
"scope": "subscriptions/xxx",
"createdOn": "2023-09-28T14:02:00.5306317Z",
"modifiedOn": "2023-09-28T14:02:00.5306317Z",
"query": {
"type": "Usage",
"timeframe": "MonthToDate",
"dataSet": {
"granularity": "Daily",
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "SubscriptionName"
}
],
"sorting": [
{
"direction": "Ascending",
"name": "UsageDate"
}
]
},
"includeMonetaryCommitment": false
},
"dateRange": "ThisMonth",
"currency": null,
"chart": "StackedColumn",
"accumulated": "True",
"metric": "AmortizedCost",
"kpis": null,
"pivots": [
{
"type": "Dimension",
"name": "ServiceName"
},
{
"type": "Dimension",
"name": "MeterCategory"
},
{
"type": "TagKey",
"name": "swaggerTagKey"
}
]
}
}
```
Deployement appeared successfull (Response Code: 201).
But final result in azure portal is showing view with "ActualCost" metric type.

Contributor guide
Research direction
Start with the Cost Management Views create-or-update-by-scope request-body documentation linked in the report and compare its metric values with the supplied JSON request. Reproduce the 201 response and check whether the resulting portal view preserves AmortizedCost; done means the documented API behavior and observed result are reconciled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100