Azure Policy trigger on Azure Budget alert

GAURAV SINGH 1 Reputation point
2023-02-27T13:39:32.4+00:00

We need to assign azure policy to deny the creation of new resources to a subscription whose budget has been reached. And once it is below limit, the policy should be removed from that subscription automatically .So how can we integrate Azure Policy with Azure Budget. or Is there any other simple solution.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,076 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
799 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 22,396 Reputation points
    2023-02-28T07:46:55.27+00:00

    Hi @GAURAV SINGH

    I can give you some pointers to get started. You can integrate Azure Policy with Azure Budget by creating an action group in Azure Monitor that will trigger a Logic App when a budget threshold is reached. The Logic App can then assign the policy definition to the subscription.

    To control Azure spending limits, when you create a budget for a subscription or resource group scope, you can configure it to call an action group. The action group can perform various actions when your budget threshold is met.

    When the budget is no longer over the threshold, the Logic App can remove the policy definition from the subscription. Here are some of the steps you need to take to create an action group in Azure Monitor:

    1. Sign into the Azure portal and select All services > Monitor.
    2. Select Alerts then select Manage actions.
    3. Select Add an action group from the Action groups area.
    4. Add and verify the following items: Action group name
      Short name
      Subscription
      Resource group
    5. Within the Add action group pane, add a LogicApp action. Name the action something like Budget-BudgetLA. In the Logic App pane, select the Subscription and the Resource group. Then, select the Logic app that you created earlier in this tutorial.
    6. Select OK to set the Logic App. Then, select OK in the Add action group pane to create the action group.

    You can find more information on how to create an action group in Action group: https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/tutorial-acm-create-budgets

    Other references:
    https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/spending-limit
    https://learn.microsoft.com/en-us/azure/cost-management-billing/understand/plan-manage-costs

    Hope this helps!
    Please accept as answer and upvote if the above information is helpful for the benefit of the community.