@Chandrakant Pawle Greetings!
To create a budget alert using the Azure CLI, you'll need to use the az consumption budget
command. This command lets you define a budget and set up alerts for when your spending approaches or exceeds your budget threshold. Source link - https://video2.skills-academy.com/en-us/cli/azure/consumption/budget?view=azure-cli-latest
Here is an example of how you can create a budget alert using Azure CLI:
Ensure you have the Azure CLI installed and are logged in. You can log in using:
az login
Create a budget:
az consumption budget create --amount 1000 \
--time-grain monthly \
--name MyBudget \
--resource-group MyResourceGroup \
--category cost \
--start-date 2024-01-01 \
--end-date 2024-12-31
Create an action group:
az monitor action-group create --resource-group MyResourceGroup \
--name MyActionGroup \
--short-name MyAG \
--email-receiver name=myemail@example.com email=myemail@example.com
Create a budget alert:
az monitor metrics alert create --name MyBudgetAlert \
--resource-group MyResourceGroup \
--scopes /subscriptions/{subscription-id}/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM \
--condition "total cost > 1000" \
--action-group MyActionGroup
Replace the placeholders with your actual values. This will create a budget of $1000 for the specified resource group, set up an action group to send email notifications, and create an alert that triggers when the budget is exceeded.
You can refer to Azure budget documentation - https://video2.skills-academy.com/en-us/azure/cost-management-billing/costs/tutorial-acm-create-budgets?tabs=clibudget#create-and-edit-budgets
Let us know if you need any further assistance!
If the response helped, do "Accept Answer" and up-vote it