Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 30, 2021 07:28 pm GMT

DevOps/Github service notifications using Azure Logic Apps

Github/DevOps service status

As described in my previous post, you can easily check the status of Github and DevOps services:

Additionally, status pages for both Github and DevOps have RSS feeds we can subscribe to. In fact the Azure platform itself also has its own health status page you can take a look at here: https://status.azure.com/en-us/status/.

In todays tutorial we will build a basic Azure Logic App that will subscribe to each services RSS feed and send us email notifications on feed updates, such as when services become degraded, when health issues occur or when health issues get remediated.

What is an Azure Logic app?

Azure Logic Apps is a cloud-based platform for creating and running automated workflows that integrate your apps, data, services, and systems. With this platform, you can quickly develop highly scalable integration solutions for your enterprise and business-to-business (B2B) scenarios. As a member of Azure Integration Services, Logic Apps simplifies the way that you connect legacy, modern, and cutting-edge systems across cloud, on premises, and hybrid environments.

What do we need?

  1. Azure Logic App: We will create a multi-tenant logic app using the Consumption pricing plan.
  2. Email Account: We will also need an email account from a service that works with Azure Logic Apps, such as Outlook.com. For other supported email providers, review Connectors for Azure Logic Apps.

Create Logic App

In the Azure portal search for logic app and then add and create the logic app with the following configuration. Under the Basics blade, add the following Instance Details:

NameValue
TypeConsumption
Logic App name{Name}
PublishWorkflow
Region{Region}

create

Configure Logic App

After the logic app has been created navigate to the logic app resource, once you click on the resource, the Azure portal will navigate you into the Logic Apps Designer, here you will select Blank Logic App:

blank01

Next we will create a schedule trigger. On the connectors and triggers search bar type: schedule and select the trigger called recurrence:

schedule

We will set this trigger to run every 3 minutes.

time

Next we will add each of our RSS feeds as parallel actions underneath our schedule. Click on + New step underneath the recurrence trigger and search for rss. We will add the action "List all RSS feed items" 3x times as we want to check three RSS feeds, one for each service:

rss_actions

We will configure each action under our recurrence schedule with the following values:

Parameter NameValue
The RSS feed URL{RSS URL Feed}
sinceaddminutes(utcnow(), -3)

NOTE: We are only using the since parameter and an expression addminutes(utcnow(), -3) as the value, which will basically instruct our logic app to check the given RSS feed for any new posts within the last 3 minutes. Since our logic app will run on a recurring schedule every 3 minutes, checking for new posts within the last 3 minutes, we should never miss any updates.

function

Also note that we can rename our action so that it is easier to identify:

rename02

After setting up our first RSS action, underneath our schedule trigger we will click on the + sign and select the option add a parallel branch:

parallel01

Similarly we will add an action for our devops status RSS feed and repeat the process a third time to also add our azure status RSS feed. After adding all our feeds as parallel actions, our Logic App design should look like this:

actions_final

Now that all 3 actions have been set up the last thing we need to configure are our email actions. We will create 3x email actions, one for each RSS feed. After each action you will see a + sign. Click on the + and select Add an action:

action01

Search for control and then select the action for each:

fore_each

We can again rename our control action so that it is easier to identify. Within the for each action we will configure Body as the output from previous steps and then add an action. In the search box, enter send an email so that you can find connectors that offer this action. If you have a Microsoft work or school account and want to use Office 365 Outlook. Or, if you have a personal Microsoft account, select Outlook.com. This example continues with Outlook.com. Select Send and email (V2):

email02

Many connectors require that you first create a connection and authenticate your identity before you can continue. Our selected email service prompts us to sign in and authenticate our identity before we can continue:

auth

Once authenticated we can configure our e-mail template:

template01

Note that we can use dynamic content to add details about the RSS published feed we configured from each trigger, to our email template:

dynamic

As you can see from the next screen, we have created 3x email actions, each with their own unique email template for each given services RSS status feed.

final03

Now save the logic app and that is it. Optionally you can also select Run Trigger to manually trigger a run.

save

Every time a health status is posted to any of our configured RSS feeds, we will be notified of the health status of the particular service that is affected.

mail01

mail02

I hope you have enjoyed this post and have learned something new. You can also find the JSON code sample and template of the Logic App we built in this tutorial on my Github page.

Author

.ltag__user__id__620034 .follow-action-button { background-color: #0cbb58 !important; color: #000000 !important; border-color: #0cbb58 !important; }
pwd9000 image

Original Link: https://dev.to/pwd9000/devops-github-service-notifications-using-azure-logic-apps-124e

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To