Hello Guha, Satyaki,
The issue likely due to incorrect URL construction or handling of the api-version
parameter. The api-version
parameter must appear after the question mark (?
) in the URL as a query string. If it's incorrectly placed or omitted, as shown below, it results in a 400 Bad Request error.
I tested the scheduled action creation and update using Postman, and it worked as expected.
https://management.azure.com/subscriptions/XXXXXXX/providers/Microsoft.CostManagement/scheduledActions/test-rule?api-version=2025-03-01
{
"properties": {
"displayName": "Weekly anomaly by resource group",
"scope": "subscriptions/XXXXXXXXX",
"status": "Enabled",
"viewId": "/subscriptions/XXXXXXX/providers/Microsoft.CostManagement/views/ms:DailyAnomalyByResourceGroup",
"schedule": {
"frequency": "Weekly",
"hourOfDay": 12, // Hour of day the alert should run
"daysOfWeek": [1], // Set to Monday (1) to run weekly on Monday
"weeksOfMonth": null, // No specific weeks of the month
"dayOfMonth": 0, // Day of month, not needed for weekly
"startDate": "2025-08-14T17:25:41.276Z", // Start date for the scheduled action
"endDate": "2026-08-14T17:25:41.276Z" // End date for the scheduled action
},
"notification": {
"subject": "Cost anomaly detected in subscription", // Notification subject
"message": "", // Message body, if needed
"to": ["******@gmail.com"], // Email recipient
"language": "en", // Language for the notification
"regionalFormat": "en" // Regional format for the notification
},
"notificationEmail": "******@gmail.com" // Notification email
}
}
Important: Ensure that the scope specified in the JSON payload matches the scope selected in the Azure Portal.
Please let me know if you face any challenge here, I can help you to resolve this issue further
Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.