question

MarkWoolaway-9275 avatar image
0 Votes"
MarkWoolaway-9275 asked SwathiDhanwada-MSFT edited

Budgets REST API

https://docs.microsoft.com/en-us/rest/api/consumption/budgets/create-or-update

I am trying to use the above the REST API. I have managed to create a budget, but I cannot create a notification.

I am posting

{
"notifications": {
"Actual_GreaterThan_80_Percent": {
"enabled": true,
"operator": "GreaterThan",
"threshold": 80,
"locale": "en-us",
"contactEmails": [
"someperson@somelocation.co.uk"
],
"thresholdType": "Actual"
}
}
}


and the response I get is

{
"error": {
"code": "400",
"message": "Invalid budget configuration, please use filter interface with 2019-05-01-preview version (Request ID: 4d49576c-f24b-4cda-a09c-973bc2b58441)"
}
}

azure-cost-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SwathiDhanwada-MSFT avatar image
0 Votes"
SwathiDhanwada-MSFT answered SwathiDhanwada-MSFT edited

@MarkWoolaway-9275 Thanks for your question. I have tested from my end, and I was able to create budget using REST API. For your reference, I have shared the request body of the REST API. Kindly retry the REST API operation and revert if you have further questions.

 {
   "eTag": "\"1d34d016a593709\"",
   "properties": {
     "category": "Cost",
     "amount": 100.65,
     "timeGrain": "Monthly",
     "timePeriod": {
       "startDate": "2022-05-01T00:00:00Z",
       "endDate": "2022-05-31T00:00:00Z"
     },
     "notifications": {
       "Actual_GreaterThan_80_Percent": {
         "enabled": true,
         "operator": "GreaterThan",
         "threshold": 80,
         "locale": "en-us",
         "contactEmails": [
           "xxxxxxx@microsoft.com"
         ],
         "contactRoles": [
           "Contributor",
           "Reader"
         ]
         "thresholdType": "Actual"
       }
     }
   }
 }

Image for your reference.

200489-image.png


I assume you are not adding below properties within your request body which are mandatory to create the budget alert.

  • properties.amount

  • properties.category

  • properties.timeGrain

  • properties.timePeriod





image.png (117.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.