Logic Apps are part of a single integrated offering from Microsoft called the App Services which brings together best application building capabilities inside of Microsoft Azure. Logic Apps democratizes building complex integration process for users, IT Pros and developers alike. It empowers users automate business processes and integrate disparate data sources at cloud scale within rich system of enterprise-grade built-in connectors. Integrating between SaaS apps, on-premises backend services and custom APIs can now be done in a consistent, durable and reliable manner in the cloud.
This lab includes the following tasks:
- Create a Customer database
- Create an instance of an API App
- Create an instance of a Logic App
- Test the Logic App
In this task you will create a database to store customer records.
-
Visit Azure Preview Portal http://portal.azure.com and login with your Microsoft Azure credentials.
-
Click on New button from the upper left corner.
-
Click Data + Storage and then SQL Database.
-
Enter a database Name, fill in required information in the tiles and then click Create. Be sure to note down database login information.
-
Click "Open in Visual Studio" button from the toolbar at the top.
-
Click on Configure your firewall.
-
Make a note of Client IP Address.
-
Enter Rule1 in the Rule Name text box. Add the IP address noted earlier in the STARTUP IP and END AIP text boxes. Click Save button in the toolbar from the top.
-
Click Open in Visual Studio in the Open in Visual Studio blade.
-
Click Allow.
-
Enter database credentials you created earlier.
-
Open a New Query.
-
Paste the following statement and click Execute button to create a Customer table.
CREATE TABLE [dbo].[Customer] ( [CustomerID] INT IDENTITY (1, 1) NOT NULL, [LastName] VARCHAR (255) NULL, [FirstName] VARCHAR (255) NULL, [Phone] VARCHAR (50) NULL, [Address] VARCHAR (255) NULL, [City] VARCHAR (50) NULL, [Processed] VARCHAR (50) NULL, CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED ([CustomerID] ASC) );
In this task you will create an instance of SQL Connector Api App to access Customer data.
-
Visit.
-
Click Home from the top left navigaton bar.
-
Click Marketplace.
-
Enter SQL Connector in the search box and press Enter.
-
Click Microsoft SQL Connector.
-
Click Create.
-
Enter the following values in the Microsoft SQL Connector blade.
Name: MicrosoftSqlConnectorCRM App Service Name: MyAppServicePlan Resource Group: MyApiRG -
Click PACKAGE SETTINGS. Enter the fully qualified domain name for Server Name, User Name, Password and the following values.
![Package Settings 1 of 2](./images/package-settings-1.png)Database Name: crm Tables: Customer Data Available Query: select count(*) from Customer where Processed = 'false' Poll Data Query: select * from Customer where Processed = 'false';UPDATE Customer SET Processed='true' WHERE Processed='false' -
Click OK. Click Create.
-
Click Add.
In this task you will create a Logic App to receive a text message whenever a customer data is created in the CRM database.
-
Click on New button from the upper left corner.
-
Clicl Web + Mobile and then click Logic App.
-
Enter a Name, select the APP SERVICE PLAN created previously and then click Create button.
-
Click Triggers and actions in the Summary tile.
-
Click Microsoft SQL Connector listed the API Apps pane under the resource group created earlier.
-
Click Poll Data (JSON).
-
Enter Frequency and Interval with the following values. Click the green check box.
Frequency: Minutes Interval: 1 -
Click Twilio Connector listed in the API Apps pane under Recommended Apps.
-
Enter Account SID and Auth Token of your Twilio subscription. Clikc green check mark.
Note: No-charge developer test credentials are availble. Visit this link for more information: https://www.twilio.com/docs/api/rest/test-credentials
-
Click Send Message.
-
Enter From Phone Number assigned by Twilio.
-
Enter To Phone Number where your messages will be sent.
Note: A test phone number is available without incurring charges. Visit this link for more information: https://www.twilio.com/docs/api/rest/test-credentials
-
Enter the following in to Text for content of the messqage.
@{first(triggers().outputs.body.Rows).FirstName}+@{first(triggers().outputs.body.Rows).LastName}+@{first(triggers().outputs.body.Rows).Phone}
-
Click Save from the toolbar at the top.
In this task you will test the Logic App that was create in the last task.
-
Click Home from the left navigation bar.
-
Click CRM SQL DATABASE tile.
-
Click Open in Visual Studio from the top toolbar.
-
Open a New Query.
-
Paste and select the following statements and then click Execute button to add customer records.
INSERT INTO [Customer] ([LastName], [FirstName], [Phone], [Address], [City], [Processed]) VALUES (N'Stewart', N'Smith', N'555-555-5555', N'22 Spruce street', N'Orlando',N'false') INSERT INTO [Customer] ([LastName], [FirstName], [Phone], [Address], [City], [Processed]) VALUES (N'Orlando', N'Gee',N'555-555-5555', N'1001 Green street', N'New York',N'false')
-
Ensure two text messages arrive at the To Phone Number entered earlier in the Twilio API Connector.
##Summary
By completing this lab you have learned the basic concepts of Logic Apps in the Azure App Service.