t sponsors stephen siciliano senior program manager, microsoft inside logic apps biztalk summit 2015...
TRANSCRIPT
tSponsors
Stephen SicilianoSenior Program Manager, Microsoft
Inside Logic Apps
BizTalk Summit 2015 – LondonExCeL London | April 13th & 14th
Agenda Introduction
Background
Basic scenario – WebHook initiated Logic App
Taking it to the next level Repeats Conditionals Parameters
API APPS
Easily build and consume APIs in the
cloud
WEB APPSWeb apps that scale with
your business
LOGIC APPS
Automate business process across SaaS and
on-premises
MOBILE APPSBuild Mobile apps for
any device
App Service
LOGIC APPS
Automate business process across SaaS and
on-premises
New Logic Apps for easy automation
• No code designer for rapid creation
• Dozens of pre-built templates to get started
• Out of box support for popular SaaS and on-premises apps
• Use with custom API apps of your own
• BizTalk APIs for expert integration scenarios
All of the Azure-native capabilities you’d expect
• Full audit logs of all management operations• Role-based access control • Deployment lifecycle with Resource Manager• Resource Management API + resource PowerShell • On-prem support with next release of Azure Pack
Azure Resource ManagerThe Azure Resource manager is a highly-scalable geo-distributed system that handles millions of resources across 100,000’s of subscriptions.
Same underlying engine…RESOURCE MANAGER
Can handle thousands of parallel deployments per stamp
Resilient against failure – retries with “at least once” guarantee
Simple, declarative JSON template
Automatically infers dependences between resources
LOGIC APPS
Can handle thousands of parallel runs per stamp
Resilient against failure – retries with “at least once” guarantee
Simple, declarative JSON definition
Automatically infers dependences between actions
{ "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "variables": { "myWorkerSize": 0 }, "parameters": { "siteName": { "type": "string" }, "hostingPlanName": { "type": "string" }, "siteLocation": { "type": "string" }, "sku": { "type": "string", "allowedValues": [ "Free", "Shared", "Basic", "Standard" ], "defaultValue": "Free" }, "workerSize": { "type": "string", "allowedValues": [ "0", "1", "2" ], "defaultValue": "0" } }, "resources": [ { "name": "myplan1", "type": "Microsoft.Web/serverfarms", "apiVersion": "2014-04-01-preview", "location": "West US", "tags": { "dept": "test" }, "properties": { "Name": "myplan1", "sku": "Free", "workerSize": "[variables('myWorkerSize')]", "numberOfWorkers": 1 } }, { "name": "[parameters('siteName')]", "type": "Microsoft.Web/sites", "apiVersion": "2014-04-01-preview", "location": "[parameters('siteLocation')]", "tags": { "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource" }, "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" ], "properties": { "name": "[parameters('siteName')]", "serverFarm": "[parameters('hostingPlanName')]" }, "resources": [ { "name": "MSDeploy", "type": "Extensions", "apiVersion": "2014-04-01-preview", "dependsOn": [ "[concat('Microsoft.Web/Sites/', parameters('siteName'))]" ], "properties": { "packageUri": "https://auxmktplceprod.blob.core.windows.net/packages/ASPNETEmptySite.zip", "dbType": "None", "connectionString": "", "setParameters": { "Application Path": "[parameters('siteName')]" } } } ] } ]}
{ "$schema": "http://schema.management.azure.com/providers/Microsoft.Logic/schemas/2014-12-01-preview/workflowdefinition.json#", "contentVersion": "1.0.0.0", "parameters": { "keyword": { "defaultValue": "logicapps", "type": "string" } }, "triggers": { "twitterconnector": { "recurrence": { "frequency": "Hour", "interval": 1 }, "type": "ApiApp", "inputs": { "apiVersion": "2015-01-14", "host": { "id": "/subscriptions/423db32d-4f58-4220-961c-b59f14c962f1/resourcegroups/bpmdemo003/providers/Microsoft.AppService/apiapps/twitterconnector", "gateway": "https://bpmdemo003423db32d4f584220961cb59f14c962f1.azurewebsites.net" }, "operation": "TriggerOnNewTweet", "parameters": { "triggerId": "@workflow().name", "parameters": { "callbackUrl": "@accessKeys('default').primary.secretRunUri", "inputs": { "Keywords": "@parameters('keyword')" } } }, "authentication": { "type": "Raw", "scheme": "Zumo", "parameter": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtc25hbWUiOiJFTUEuUmVzb3VyY2VQcm92aWRlciIsImZ1bGxyb3ciOiJhbGwiLCJ2ZXIiOiIzIiwidWlkIjoic2lkOjE0Mjc0NzcwNjcxNDAiLCJpc3MiOiJ1cm46bWljcm9zb2Z0OndpbmRvd3MtYXp1cmU6enVtbyIsImF1ZCI6InVybjptaWNyb3NvZnQ6d2luZG93cy1henVyZTp6dW1vIiwibmJmIjoxNDI3NDc3MDY5fQ.ihuWiXgyOpsG64Du6sAnRXxZGM_wtrJF0CJH0y-Rxfs" } }, "conditions": [ { "expression": "@bool('false')" } ] } }, "actions": { "dropboxconnector": { "type": "ApiApp", "inputs": { "apiVersion": "2015-01-14", "host": { "id": "/subscriptions/423db32d-4f58-4220-961c-b59f14c962f1/resourcegroups/bpmdemo003/providers/Microsoft.AppService/apiapps/dropboxconnector", "gateway": "https://bpmdemo003423db32d4f584220961cb59f14c962f1.azurewebsites.net" }, "operation": "UploadFile", "parameters": { "FilePath": "@concat('tweets/logicapps/',triggers().outputs.body.Tweet_ID)", "content": { "Content": "@triggers().outputs.body.TweetText", "ContentTransferEncoding": "None" }, "overwrite": true }, "authentication": { "type": "Raw", "scheme": "Zumo", "parameter": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtc25hbWUiOiJFTUEuUmVzb3VyY2VQcm92aWRlciIsImZ1bGxyb3ciOiJhbGwiLCJ2ZXIiOiIzIiwidWlkIjoic2lkOjE0Mjc0NzcwNjcxNDAiLCJpc3MiOiJ1cm46bWljcm9zb2Z0OndpbmRvd3MtYXp1cmU6enVtbyIsImF1ZCI6InVybjptaWNyb3NvZnQ6d2luZG93cy1henVyZTp6dW1vIiwibmJmIjoxNDI3NDc3MDY5fQ.ihuWiXgyOpsG64Du6sAnRXxZGM_wtrJF0CJH0y-Rxfs" } }, "conditions": [ ] } }, "outputs": { }}
… more powerRESOURCE MANAGER
8 functions for basic referencing and string functions
Can only PUT resources into resource groups
Auth must be through AAD
Triggered manual through API
LOGIC APPS
Over 50 functions from string manipulations to math, to sets operations, to logical operators
All HTTP operations supported on any arbitrary endpoint
Supports many OAuth providers, AAD, Cert auth, or Basic auth
4 different ways to be triggered
User adds an item to a list in their Mobile app
Mobile app has the callback URI for the workflow
When the callback URI is
called, the workflow
immediately starts the
“first*” action
All dependent actions in the
workflow continue as
normal
Actions with simple orchestration
3 ways to introduce dependences between actions:
1. Implicitly – whenever you reference the output of an action you’ll depend on that action executing first
2. Explicit “dependsOn” condition – you can mark certain actions to run only after previous ones have completed“dependsOn” : “twitterconnector”
3. Explicit “expression” condition – a complex function that evaluates properties of other actions“expression” : “@equals(actions(‘twitterconnector’).code, ‘InternalServerError’)”
Triggering a Logic app “Run” Recurring schedule – “every X hours”
Polling an API for a response A 200 response means “run” -- a 202 response means “wait” Can use trigger state to get information on the previous execution
Registering an API App to “push” to a workflow Using a custom contract implemented for API Apps
WebHook Every workflow has an endpoint you can POST to from any web
service Supports Basic auth for simple systems
Manually User can click the “Run Now” button in the portal
Repeating Loop a single action over a list of items
Runs the action N times
You can get at all of the statuses for each action
Tip: when you have multiple collections use: "repeat" :
"@range(0,length(body('connector1')))" … "inputs" : "@concat(body('connector1')
[repeatItem()], body('connector2')[repeatItem()])"
Conditionals Logic on a trigger or action For triggers conditionals are post-
conditions For actions conditionals are pre-
conditions
You can do conditionals inside of repeats to perform as a filter
Parameters
Dev Workflow Prod Workflow
DefinitionDeclares
parameters
Uri: @parameters (‘endpoint’)
Definition(identical)
Declares same parameters
Uri: @parameters (‘endpoint’)
ParametersProvides DEV
config
Endpoint : “http://int.mysite
.net”
ParametersProvides PROD
config
Endpoint : “http://mysite.ne
t”
• Re-using values, or even complex objects, throughout the definition, which makes it easier to comprehend
• Separate out config from the definition itself, making sharing easy, as well as across different environments.
Messages Large message support is built-in (<100 MB)
To handle binary blobs of data you can: 1. Externalize state (save it to Azure storage) 2. Base64 encode it and return it directly in the workflow
(workflows are JSON)
All messages are archived Retention period depends on the App Service plan
Debugging tips Try calling the API App directly: POST {gatewayURI}/api/service/invoke/{api app
name}/{operation name}?api-version=2015-01-14 x-zumo-auth : {your token} This may be a faster way to iterate if you are seeing failures
Use requestb.in to debug triggers – you can inspect all incoming requests
Enable logging for the Web app hosting the API App
*New* you can Cancel a Run if it is failed