Is it possible to send a notification to Slack when the subscription fee ratio changes rapidly?

shohei_kobayashi 45 Reputation points
2024-04-08T07:08:10.0366667+00:00

Is it possible to send a notification to Slack when the subscription fee ratio changes rapidly?

For example:

The previous month's subscription fees for service A, B, and C were 50%, 30%, and 20%, respectively, but this month they changed to 80%, 10%, and 10%. Therefore, a notification was sent to Slack.

I also don't quite understand why "Anomaly" as Alert type cannot be selected when creating Costs alerts. It writes: "Not available for billing accounts. Please change scope to a subscription."

Thank you very much for your support in advance.

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

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 46,201 Reputation points Microsoft Employee
    2024-04-16T20:20:13.4166667+00:00

    Hello @shohei_kobayashi Thank you for contacting us on Microsoft Q&A platform. Happy to assist you!

    From the tile of the post, I understand that you want to know if it is possible to trigger notification to Slack when the subscription fee ratio changes rapidly.

    I have not tried this personally, you may want to give a shot:

    Create a log alert rule in Azure Monitor to monitor the changes in subscription fees and configure an action group to send notifications to Slack. Here are the steps to create a log alert rule:

    1. Go to the Azure portal and navigate to the Azure Monitor service.
    2. Click on "Alerts" in the left-hand menu and then click on "New alert rule".
    3. In the "Scope" section, select the subscription that you want to monitor.
    4. In the "Condition" section, select "Signal logic" and then select "Custom log search".
    5. In the "Custom log search" section, enter the following query to calculate the subscription fee ratio:

    AzureConsumption | where ResourceType == "subscriptions" | where TimeGenerated >= ago(30d) | summarize TotalCost = sum(Cost) by SubscriptionId | extend Ratio = TotalCost / toscalar(TotalCost)

    This query calculates the subscription fee ratio for the last 30 days.

    1. In the "Alert logic" section, set the threshold for the subscription fee ratio. For example, you can set the threshold to 0.5 if you want to be notified when the subscription fee ratio for a service exceeds 50%.
    2. In the "Action group" section, configure an action group to send notifications to Slack. You can follow the instructions in this article to create an action group that sends notifications to Slack: https://docs.microsoft.com/en-us/azure/azure-monitor/platform/action-groups#create-an-action-group

    Regarding your question about the "Anomaly" alert type, it is not available for billing accounts because it requires a machine learning model to detect anomalies in the data. This feature is only available for subscriptions, not billing accounts.

    Hope this helps!

    1 person found this answer helpful.
    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.