{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "contentVersion": "1.0.0.0", "triggers": { "manual": { "type": "Request", "kind": "Http", "inputs": { "schema": { "properties": { "fileNames": { "type": "array" }, "message": { "type": "string" }, "pipelineName": { "type": "string" }, "receiver": { "type": "string" } }, "type": "object" } } } }, "actions": { "For_each": { "type": "Foreach", "foreach": "@triggerBody()?['fileNames']", "actions": { "Append_to_array_variable": { "type": "AppendToArrayVariable", "inputs": { "name": "Attachments", "value": { "ContentBytes": "@{body('Get_blob_content_(V2)')}", "Name": "@{substring(items('For_each'), add(lastIndexOf(items('For_each'),'/'), 1), sub(sub(length(items('For_each')),1), lastIndexOf(items('For_each'),'/')))}" } }, "runAfter": { "Get_blob_content_(V2)": [ "Succeeded" ] } }, "Get_blob_content_(V2)": { "type": "ApiConnection", "inputs": { "host": { "connection": { "referenceName": "azureblob" } }, "method": "get", "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('https://xxxx.blob.core.windows.net/'))}/files/@{encodeURIComponent(encodeURIComponent(items('For_each')))}/content", "queries": { "inferContentType": false } } } }, "runAfter": { "Initialize_variable": [ "Succeeded" ] } }, "Initialize_variable": { "type": "InitializeVariable", "inputs": { "variables": [ { "name": "Attachments", "type": "array" } ] }, "runAfter": {} }, "Send_an_email_(V2)": { "type": "ApiConnection", "inputs": { "host": { "connection": { "name": "@parameters('$connections')['office365']['connectionId']" } }, "method": "post", "body": { "To": "@triggerBody()?['receiver']", "Subject": "Message from pipeline @{triggerBody()?['pipelineName']}", "Body": "

@{triggerBody()?['message']}

", "Attachments": "@variables('Attachments')", "Importance": "Normal" }, "path": "/v2/Mail" }, "runAfter": { "For_each": [ "Succeeded" ] } } }, "outputs": {}, "parameters": { "$connections": { "type": "Object", "defaultValue": {} } } }, "parameters": { "$connections": { "value": { "azureblob": { "connectionId": "/subscriptions/yyyy/providers/Microsoft.Web/connections/azureblob", "connectionName": "azureblob", "id": "/subscriptions/zzzz/providers/Microsoft.Web/locations/northcentralus/managedApis/azureblob" }, "office365": { "connectionId": "/subscriptions/yyyy/providers/Microsoft.Web/connections/office365", "connectionName": "office365", "id": "/subscriptions/zzzz/providers/Microsoft.Web/locations/northcentralus/managedApis/office365" } } } } }