Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active June 9, 2018 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/6245ade21d62982180a29f26ba4e7317 to your computer and use it in GitHub Desktop.
Save justinyoo/6245ade21d62982180a29f26ba4e7317 to your computer and use it in GitHub Desktop.
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