Call custom REST Api from Azure and send Alert if it fails

Sergey Krulikovskiy 45 Reputation points
2023-12-17T19:47:52.5233333+00:00

Hello,

I have set of applications with some REST APIs. I need to create a solution to check if it is possible to login to each app. Some kind of availability test.

So I have:

  1. rest api which allows to login to app
  2. user name an password stored in Azure Key Vault
  3. almost 0 experience in C#
  4. advanced knowledge in PowerShell

Can somebody give me a hint which one Azure Service I can use for this task? Also, it would be great to have possibility to send Alerts if login fails.

Thanks in advance.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-12-18T15:36:10.79+00:00

    Sergey Krulikovskiy Thanks for posting your question in Microsoft Q&A. From the description above, you are looking for a solution to call some rest APIs based on credentials stored in Azure Key Vault, and send some alerts with evaluation and this has to happen periodically (like availability tests).

    You can explore both Azure Functions as well as Logic Apps. Both are serverless compute service but with different use case in mind Compare Azure Functions and Azure Logic Apps.

    With Azure Functions, you can use PowerShell language for implementation, and try the following:

    1. Create a time trigger function to run it periodically (like similar approach).
    2. Then retrieve secrets from Key Vault in PowerShell function and here is sample reference: https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-powershell (found similar tutorial online) and invoke custom rest APIs.
    3. Validate the results and send alerts based on your need.

    Similarly, you can implement it in Logic Apps using Recurrence trigger, Azure Key Vault connector, HTTP connector, and send alerts based on the validation results.

    I hope this helps in getting started and let me know if any questions.


    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer helpful.
    0 comments No comments

  2. Luis Arias 8,621 Reputation points Volunteer Moderator
    2023-12-18T19:29:13.0833333+00:00

    Hi Sergey Krulikovskiy,

    Taking on consideration your strengs there are two ways, one as you mention with Azure Functions and the other is by Azure logic apps (the easyest way), so here some guidelines:

    Azure function

    1. Create an Azure Function: You can create this by Azure portal or CLI. ( https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell )
    2. Define the Function: Each function script has a related function.json file that defines how the function behaves, such as how it's triggered and its input and output parameters.
    3. Test the Function: You can test the function by sending a request to the REST API endpoint. You can use PowerShell’s Invoke-RestMethod cmdlet for this. (https://adamtheautomator.com/azure-functions-powershell-2/)

    Logic Apps

    Let me know if you start your testing and need further assisstance.

    Cheers, Luis


    If the information helped address your question, please Accept the answer.

    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.