Azure alert using an Azure Automation account when the status of a function app is detected as "stopped."

Mihir Hatankar 5 Reputation points
2023-12-15T10:15:18.34+00:00

Hi Community members,

I'm attempting to set up an Azure alert using an Azure Automation account when the status of a function app is detected as "stopped." In the provided image, two function apps have a status of "stopped." I've crafted a PowerShell script to gather all function app names with a "stopped" status and stored them in an array. Now, I'm looking for a way to create an Azure alert or an Action Group alert that includes the names and statuses of all function apps directly within PowerShell. Is there a method to accomplish this using PowerShell?User's image

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} vote

1 answer

Sort by: Most helpful
  1. AnuragSingh-MSFT 21,566 Reputation points Moderator
    2023-12-19T11:04:18.9+00:00

    Mihir Hatankar, thank you for posting this question on Microsoft Q&A.

    There is no direct way to generate an alert from PowerShell or using any API. However, there are ways through which this can be achieved, 2 of which are given below:

    1. If you are only interested in getting an email notification with this information, you may use the information available in the following document to send email from Azure Automation Runbook.
    2. Another way would be sending the information to Log Analytics Workspace's custom table as a log and creating log-based alert rule to trigger. Details of which are below. The query in this case will depend on the custom table created and its columns.

    Tutorial: Send data to Azure Monitor Logs with Logs ingestion API (Azure portal)

    Tutorial: Create a log query alert for an Azure resource

    Hope this helps.

    If the answer did not help, please add more context/follow-up question for it, and we will help you out. Else, if the answer helped, please click Accept answer so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

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