Home > Net >  Alert when azure function returns a value
Alert when azure function returns a value

Time:05-31

I have an azure function that checks if a blob file exists or not. This function returns true or false, and I want to send an alert if the outout is false. (This function is in python)

CodePudding user response:

Given that you haven't provided any sample code, the first thing you should look at is the developer reference to ensure your logs are being created correctly:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi,azurecli-linux,application-level#logging

I'd recommend you look at the Monitor Azure Functions page and ensure you have Application Insights enabled.

https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring

Then you can use the following guide on how to query and analyse the App Insights data:

https://docs.microsoft.com/en-us/azure/azure-functions/analyze-telemetry-data

You may have to timeslice or aggregate the data for failures in x number of minutes.

CodePudding user response:

You could add mail functionality to the function itself, using the MS Graph API. The function would need Mail.Send permission. For sending email from a Python function you could look at this resource.

If you need to send the email outwith Azure, just invoke the HTTP function via its URL, check the output and send the email if required. You could make the function return some JSON for example:

{
  "result": true
}
  • Related