Microsoft Azure For Dummies
Book image
Explore Book Buy On Amazon
Microsoft Azure includes Logic Apps to help you build in workflows. This allows you to automate certain processes rather than manually manage.

Suppose that your company’s marketing department wants to be notified any time a current or prospective customer mentions your corporate handle on Twitter. Without Logic Apps, your developers would have to register for a developer Twitter account and API key, after which they’d need to immerse themselves in the Twitter API to understand how to integrate Twitter with your corporate notification platform.

Instead, your developers can configure a Logic App to trigger on particular Twitter tweets and send an email message to an Outlook mailbox without knowing Twitter or Office 365 APIs.

Azure Logic app workflow The workflow for an Azure Logic App.

Creating an Azure Logic App

You’re going to create a Logic App that triggers on mentions of the keyword Azure in public tweets. The resulting action sends email notifications to a mailto:[email protected] designated email address. You’ll develop your Logic App in three phases:
  • Deploying the Logic App resource
  • Defining the workflow
  • Testing the trigger and action

Deploying the resource in the Azure portal

Follow this procedure to create the Logic App resource:
  1. In the Azure portal, browse to the Logic Apps blade, and click Add.

    The Create blade opens.

  2. Complete the Logic App Create blade.

    There’s not much to creating the resource. Provide the name, subscription, resource group, and location, and specify whether you want to monitor with Log Analytics.

  3. Click Create to submit the deployment.

    When deployment is complete, click Go to Resource in the Azure notification menu to open the Logic App. You’ll be taken to the Logic Apps Designer by default.

  4. Click the X button in the top-right corner of the interface to close the blade.

Defining the Azure Logic App workflow

Follow these steps to define the Logic App workflow:

If you want to follow along with this exercise, you need Twitter and Office 365 accounts. Twitter accounts are free, but Office 365 typically is a paid SaaS product. If you like, use another email account (such as Gmail). The Logic Apps connector library is so vast, chances are good that you’ll find a service that works for you.

  1. Go to your new Logic App’s Overview blade.
  2. Choose Logic App Designer from the Settings menu.

    This command takes you to the view you saw the first time you opened the Logic App.

  3. Scroll to the Templates section, and select Blank Logic App.

    Starting with a blank Logic App enables you to become more familiar with the workflow design process, but Azure provides lots of templates and triggers that you can use for other purposes.

  4. In the Search Connectors and Triggers field, type Twitter.
  5. In the search results, select the Twitter trigger category and then click the When a New Tweet Is Posted trigger.
  6. Click Sign In, and log in to your Twitter account.
  7. Complete the When a New Tweet Is Posted form.

    Maybe you want the Logic App to trigger whenever someone mentions the keyword Azure in a tweet, so you complete the options this way:

    • Search Text: “Azure”
    • Interval: 1
    • Frequency: Minute

      Configuring a Logic App to trigger on the keyword Azure generates lot of trigger events and creates a potentially bad signal-to-noise ratio in your results. If you’re creating a Logic App for this purpose, experiment with writing more-granular trigger keywords to produce the results you desire.

  8. Click New Step.
  9. Scroll through the connector library list and look for Outlook.
  10. When you find the Outlook connectors, click the Office 365 Outlook connector.
  11. Search the actions list for Send, and select the Send an Email action.
  12. In the Office 365 Outlook connector dialog box, click Sign In, and authenticate to Office 365.
  13. Complete the Send an Email dialog box, preferably using dynamic fields.

    This step is where the procedure can get a bit messy.

    1. Put your destination Office 365 email address in the T: field.
    2. Place your cursor in the Subject field.
    3. Click Add Dynamic Content to expose the dynamic content pop-up window.

      Dynamic fields allow you to plug live data into your workflow.

      Dynamic content in a Logic App Dynamic content in a Logic App.
  14. Click Save.

Don’t overlook this step! It’s easy to miss.

Testing the Logic App trigger and action

To trigger the action, follow these steps:
  1. On the Logic App workflow toolbar, click Run.

    You must— absolutely must — switch the Logic App to a running state for it to catch the trigger.

  2. On Twitter, and post a tweet that includes a reference to Azure.
  3. Await notification.

    The tweet should trigger an email to the address you designated.

Logic App notification An email indicating that the Logic App works.

Another place to check workflow run status is the Overview page, which shows how many times the trigger was tripped, the workflow run, and/or any errors.

About This Article

This article is from the book:

About the book author:

Glen E. Clarke, A+, Network+, Security+, is an independent trainer and consultant. Ed Tetz, A+, MCSE, MCT, has written several guides to MCSE and other certifications. Timothy Warner, MCSE, MCT, A+, is an IT professional, technical trainer, and author.

This article can be found in the category: