You can add workflow definition in resources section.
- Follow this MS document for more details.
- Below is sample template code you can refer and upload json code of your workflow.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"LogicAppName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"defaultValue": "MyLogicApp",
"metadata": {
"description": "The resource name to use for the logic app"
}
},
"LogicAppLocation": {
"type": "string",
"minLength": 1,
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The resource location to use for the logic app"
}
},
"office365_1_Connection_Name": {
"type": "string",
"defaultValue": "office365",
"metadata": {
"description": "The resource name to use for the Office 365 Outlook connection"
}
},
"office365_1_Connection_DisplayName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "The display name to use for the Office 365 Outlook connection"
}
},
"azureblob_1_Connection_Name": {
"type": "string",
"defaultValue": "azureblob",
"metadata": {
"description": "The resource name to use for the Azure Blob storage account connection"
}
},
"azureblob_1_Connection_DisplayName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Name of the storage account the connector should use."
}
},
"azureblob_1_accountName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Name of the storage account the connector should use."
}
},
"azureblob_1_accessKey": {
"type": "securestring",
"metadata": {
"description": "Specify a valid primary/secondary storage account access key."
}
},
"LogicAppIntegrationAccount": {
"type":"string",
"minLength": 1,
"defaultValue": "/subscriptions/<Azure-subscription-ID>/resourceGroups/fabrikam-integration-account-rg/providers/Microsoft.Logic/integrationAccounts/fabrikam-integration-account",
"metadata": {
"description": "The ID to use for the integration account"
}
}
},
"variables": {},
"resources": [
{
"properties": {
"state": "Disabled",
"integrationAccount": {
"id": "[parameters('LogicAppIntegrationAccount')]"
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Create_blob": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
}
},
"method": "post",
"body": "@triggerBody()?['Body']",
"path": "/datasets/default/files",
"queries": {
"folderPath": "/emails",
"name": "@triggerBody()?['Subject']",
"queryParametersSingleEncoded": true
},
"runAfter": {},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
}
},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_new_email_arrives": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "get",
"path": "/Mail/OnNewEmail",
"queries": {
"folderPath": "Inbox",
"importance": "Any",
"fetchOnlyWithAttachment": false,
"includeAttachments": false
}
},
"recurrence": {
"frequency": "Day",
"interval": 1
},
"splitOn": "@triggerBody()?['value']"
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('LogicAppLocation'), '/managedApis/', 'azureblob')]",
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('azureblob_1_Connection_Name'))]",
"connectionName": "[parameters('azureblob_1_Connection_Name')]"
},
"office365": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('LogicAppLocation'), '/managedApis/', 'office365')]",
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('office365_1_Connection_Name'))]",
"connectionName": "[parameters('office365_1_Connection_Name')]"
}
}
}
},
"accessControl": {}
},
"name": "[parameters('LogicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('LogicAppLocation')]",
"tags": {
"displayName": "LogicApp"
},
"apiVersion": "2019-05-01",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('azureblob_1_Connection_Name'))]",
"[resourceId('Microsoft.Web/connections', parameters('office365_1_Connection_Name'))]"
]
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('office365_1_Connection_Name')]",
"location": "[parameters('LogicAppLocation')]",
"properties": {
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('LogicAppLocation'), '/managedApis/', 'office365')]"
},
"displayName": "[parameters('office365_1_Connection_DisplayName')]"
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('azureblob_1_Connection_Name')]",
"location": "[parameters('LogicAppLocation')]",
"properties": {
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('LogicAppLocation'), '/managedApis/', 'azureblob')]"
},
"displayName": "[parameters('azureblob_1_Connection_DisplayName')]",
"parameterValues": {
"accountName": "[parameters('azureblob_1_accountName')]",
"accessKey": "[parameters('azureblob_1_accessKey')]"
}
}
}
],
"outputs": {}
}
- Workflow definition need to be included in Microsoft.Logic/workflows`resource type.
- Using custom deployment in azure portal, I have uploaded above template file and it is created logic app, blob api connection and office 365 connection.
