Hello @Sanjay Nipane Thank you for contacting on Microsoft Q&A platform. Happy to help!
As I understand your requirement to automate creation of custom view under Azure Cost Analysis for multiple subscriptions. You can use Cost Management Create/Update views API to programmatically create Cost Management Views:
https://learn.microsoft.com/en-us/rest/api/cost-management/views/create-or-update-by-scope?tabs=HTTP
Example payload which you can customize:
{
"properties": {
"currency": "USD",
"dateRange": "LastMonth",
"query": {
"type": "ActualCost",
"dataSet": {
"granularity": "Daily",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"sorting": [
{
"direction": "ascending",
"name": "UsageDate"
}
],
"grouping": [
{
"type": "Dimension",
"name": "ServiceName"
}
]
},
"timeframe": "None"
},
"chart": "Area",
"accumulated": "true",
"pivots": [
{
"type": "Dimension",
"name": "ServiceName"
},
{
"type": "Dimension",
"name": "ResourceLocation"
},
{
"type": "Dimension",
"name": "ResourceGroupName"
}
],
"scope": "subscriptions/{SubscriptionGUID}",
"kpis": [
{
"type": "Forecast",
"enabled": true
}
],
"displayName": "{ViewName}"
}
}
Hope this helps!
If the response helped, do "Accept Answer" and up-vote it