enforcing cost limit per subscription or tenant to not exceed monthly allowed amount.

Vasanth Rao Jadav 41 Reputation points
2024-05-16T19:32:26.73+00:00

Hi MSFT Team,

I would like enforce a cost limit per subscription or tenant level, to make sure I am not exceeding the limit I want to spend irrespective of POCs.

ex: I want to spend monthly $20, If cost exceeds, new instances not supposed to be created and already existing instances supposed to suspended if it's involves cost.

How to achieve that. Please lay out the steps that I can follow to implement.

Note: as of now, I am able to create a cost limit alters with email notification, however this is not a ideal solutions for personal use.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,241 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 39,921 Reputation points Microsoft Employee
    2024-05-16T23:04:55.3533333+00:00

    Hello @Vasanth J Thank you for reaching out to us on Microsoft Q&A platform. Happy to answer any questions you may have!

    Based on the information you provided, I understand that you are looking for a solution to enforce cost limits and restrict resource creation at subscription/tenant level.

    There are two approaches to accomplish this requirement:

    No. 1:

    1. Go to the Azure portal and navigate to the "Cost Management + Billing" page.
    2. Select the subscription or tenant that you want to set the cost limit for.
    3. Click on the "Budgets" tab and select "Add".
    4. Enter a name for the budget and select the appropriate scope (subscription or tenant).
    5. Select the "Cost" budget type and enter the amount that you want to spend per month.
    6. Set the appropriate threshold and alert settings. For example, you can set an alert to be triggered when the cost reaches 80% of the budget.
    7. Set the appropriate action settings. For example, you can set the budget to stop all new resource creation or suspend existing resources when the cost reaches 100% of the budget.
    8. Save the budget.

    By following these steps, you can enforce a cost limit per subscription or tenant level using Azure Budgets. It is important to note that setting a budget to stop all new resource creation or suspend existing resources can have significant impacts on your environment, so you should carefully consider the appropriate actions to take when the budget is exceeded. Additionally, you should regularly review your budgets to ensure that they are still appropriate for your needs.No. 2:

    1. Set Up Budgets and Alerts:
      • Log in to the Azure Portal and navigate to the Cost Management + Billing section.
      • Select "Cost Management" from the left-hand menu.
      • Choose "Cost Management + Billing" and then "Cost Management."
      • Click on "Budgets" and create a new budget for each subscription or tenant you want to monitor.
      • Set the budget amount to $20 per month.
      • Configure email alerts to notify you when the spending approaches or exceeds the set limit.
    2. Implement Azure Policy:
      • Navigate to the Azure Policy section in the Azure Portal.
      • Create a new policy definition.
      • Define the policy to deny the creation of new resources if it will result in exceeding the budget limit.
      • Additionally, create a policy to suspend existing resources that contribute to exceeding the budget limit.
      • Assign these policies to the appropriate subscriptions or management groups.

    By following these steps, you can effectively enforce a cost limit per subscription or tenant level in Azure and ensure that you do not exceed your desired spending limit, even during Proof of Concept (POC) activities.

    Links to refer:

    https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/tutorial-acm-create-budgets?tabs=psbudget

    https://stackoverflow.com/questions/76355129/is-there-any-way-to-restrict-creation-of-azure-resources-when-a-budget-limit-is

    Hope this helps. Feel free to reply if you have any questions or need further assistance!


    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments