Daily budget alerts

Abrar Adil S 401 Reputation points
2024-11-19T07:33:04.87+00:00

How can I set up an Azure alert to notify me if my daily costs exceed a specific threshold? I have already configured monthly budget alerts, but I need daily budget alerts based on specific threshold values. I’ve explored the "Daily Anomaly Detection by Resource Group" feature, but that’s not what I’m looking for. My requirement is a dedicated daily budget alert

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
3,642 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ki-lianK-7341 1,010 Reputation points
    2024-11-19T07:58:17.4933333+00:00

    To set up a daily budget alert in Azure, follow these steps:

    1. Create a Log Analytics Workspace:
    • Go to the Azure portal and create a Log Analytics workspace if you don’t have one
    1. Enable Cost Management Data:
    • In the Log Analytics workspace, enable the Cost Management data connector to ingest cost data. 3. Create a Custom Log Search Alert:
      • Go to Azure Monitor and select “Alerts”.
    • Go to Azure Monitor and select “Alerts”.
    • Click on “+ New alert rule”.
    • Set the scope to your subscription or resource group.
    • For the condition, use a custom log search query to check daily costs. Example query:
    Usage
    | where TimeGenerated >= startofday(now())
    | summarize TotalCost = sum(Cost) by bin(TimeGenerated, 1d)
    | where TotalCost > {your-threshold}
    
    • Set the frequency and action group for notifications.

  2. Pranay Reddy Madireddy 6,180 Reputation points Microsoft External Staff Moderator
    2024-11-20T20:47:51.9033333+00:00

    Hi Abrar Adil S

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    You can use the Azure Cost Management REST API to get cost and usage data by logging in and calling the correct endpoints.

    After getting the cost data, you can send it to your Log Analytics Workspace using the to add custom log data.

    In the Azure portal, go to Cost Management + Billing > Cost Management > Export. From there, you can schedule cost data to be automatically exported in CSV format to an Azure Storage Account.

    After exporting the data, you can use an Azure Function or Logic Apps to automatically move the CSV file from your storage account to your Log Analytics Workspace.

    For automation, you can use Azure Automation with a PowerShell script that runs on a schedule. The script will get cost data and send it to Log Analytics.

    If you have any further queries, do let us know.

    thanks,

    Pranay

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.