Instantly share code, notes, and snippets.

Embed
What would you like to do?
Separation of Concerns: Logic App from ARM Template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { ... },
"variables": { ... },
"resources": [
{
"type": "Microsoft.Logic/workflows",
...
"properties": {
"parameters": {
"$connections": {
"value": {
"arm": {
"connectionId": "/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP}/providers/Microsoft.Web/connections/{CONNECTOR_NAME}",
"id": "/subscriptions/{SUBSCRIPTION_ID}/providers/Microsoft.Web/locations/australiasoutheast/managedApis/arm"
}
}
},
"arm": {
"value": {
"subscriptionId": "{SUBSCRIPTION_ID}",
"resourceGroup": "{RESOURCE_GROUP}",
"apiVersion": "{API_VERSION}"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"type": "object",
"defaultValue": {}
},
"arm": {
"type": "object",
"defaultValue": {}
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
}
}
},
"actions": {
"GetDeploymentHistories": {
"type": "ApiConnection",
"runAfter": {},
"description": "Gets the all deployment history.",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['arm']['connectionId']"
}
},
"method": "get",
"path": "/subscriptions/@{encodeURIComponent(parameters('arm')['subscriptionId'])}/resourcegroups/@{encodeURIComponent(parameters('arm')['resourceGroup'])}/providers/Microsoft.Resources/deployments",
"queries": {
"x-ms-api-version": "@parameters('arm')['apiVersion']"
}
}
},
"Response": {
"type": "Response",
"runAfter": {
"GetDeploymentHistories": [
"Succeeded"
]
},
"description": "Returns the successful response.",
"inputs": {
"statusCode": 200,
"body": "@body('GetDeploymentHistories')?.value"
}
}
},
"outputs": {}
}
}
}
],
"outputs": { ... }
}
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { ... },
"variables": { ... },
"resources": [
{
"type": "Microsoft.Logic/workflows",
...
"properties": {
"parameters": {},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {},
"actions": {},
"outputs": {}
}
}
}
],
"outputs": { ... }
}
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"type": "object",
"defaultValue": {}
},
"arm": {
"type": "object",
"defaultValue": {}
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
}
}
},
"actions": {
"GetDeploymentHistories": {
"type": "ApiConnection",
"runAfter": {},
"description": "Gets the all deployment history.",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['arm']['connectionId']"
}
},
"method": "get",
"path": "/subscriptions/@{encodeURIComponent(parameters('arm')['subscriptionId'])}/resourcegroups/@{encodeURIComponent(parameters('arm')['resourceGroup'])}/providers/Microsoft.Resources/deployments",
"queries": {
"x-ms-api-version": "@parameters('arm')['apiVersion']"
}
}
},
"Response": {
"type": "Response",
"runAfter": {
"GetDeploymentHistories": [
"Succeeded"
]
},
"description": "Returns the successful response.",
"inputs": {
"statusCode": 200,
"body": "@body('GetDeploymentHistories')?.value"
}
}
},
"outputs": {}
}
{
"$schema": "...",
"contentVersion": "...",
"parameters": { ... },
"variables": { ... },
"resources": [
{
"apiVersion": "...",
"type": "Microsoft.Logic/workflows",
"name": "...",
"location": "...",
"tags": { ... },
"properties": {
"parameters": { ... },
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": { ... },
"triggers": { ... },
"actions": { ... },
"outputs": { ... }
}
}
}
],
"outputs": { ... }
}
{
"$connections": {
"value": {
"arm": {
"connectionId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/connections/{connectorName}",
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/australiasoutheast/managedApis/arm"
}
}
},
"arm": {
"value": {
"subscriptionId": "{subscriptionId}",
"resourceGroup": "{resourceGroup}",
"apiVersion": "{apiVersion}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment