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)
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)
3
Answers
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://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi%2Cazurecli-linux%2Capplication-level#logging
I’d recommend you look at the Monitor Azure Functions page and ensure you have Application Insights enabled.
https://learn.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://learn.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.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 someJSON
for example:Created a function in python, if any blob doesn’t exist in container, then it will send a mail through Microsoft graph API.
Python Function
In
else
part you can send a mail by usingMicrosoft Graph API
.Refer the following documentation for sending an email via Microsoft Graph API by Raymond.