Budgets REST API

Mark 41 Reputation points
2022-05-06T13:03:31.847+00:00

https://learn.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
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,341 questions
0 comments No comments
{count} votes

Accepted answer
  1. SwathiDhanwada-MSFT 18,551 Reputation points
    2022-05-10T06:15:42.15+00:00

    @Mark 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
    0 comments No comments

0 additional answers

Sort by: Most helpful