Getting Error while trying to initiate Logic App Trigger - azure

I am trying to configure a Logic App using Event Grid Trigger. The Trigger should be when my Azure CMK in my key vault is nearing expiry it should send me an email. I have configured the Logic App using the Logic App Designer, but when i try to run the trigger, it throws me the error as shown in the screenshot.
The screenshot for my designer is also attached. Any idea what do i need to do to fix this[![enter image description here][3]][3]
Also putting the code here for reference.
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Body": "<p>Your CMK will expire in 30 days</p>",
"ReplyTo": "myemailaddress ",
"Subject": "Key Expiry",
"To": "myemailaddress"
},
"host": {
"connection": {
"name": "#parameters('$connections')['outlook']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_resource_event_occurs": {
"inputs": {
"body": {
"properties": {
"destination": {
"endpointType": "webhook",
"properties": {
"endpointUrl": "#{listCallbackUrl()}"
}
},
"filter": {
"includedEventTypes": [
"Microsoft.KeyVault.KeyNearExpiry"
]
},
"topic": "/subscriptions/<subscriptionid>/resourceGroups/pallabdev/providers/Microsoft.KeyVault/vaults/testhalvault"
}
},
"host": {
"connection": {
"name": "#parameters('$connections')['azureeventgrid_1']['connectionId']"
}
},
"path": "/subscriptions/#{encodeURIComponent('subscriptionId')}/providers/#{encodeURIComponent('Microsoft.KeyVault.vaults')}/resource/eventSubscriptions",
"queries": {
"x-ms-api-version": "2017-06-15-preview"
}
},
"splitOn": "#triggerBody()",
"type": "ApiConnectionWebhook"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureeventgrid_1": {
"connectionId": "/subscriptions/<subscriptionId>/resourceGroups/PallabDev/providers/Microsoft.Web/connections/azureeventgrid",
"connectionName": "azureeventgrid",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
},
"id": "/subscriptions/<subscriptionId>/providers/Microsoft.Web/locations/canadacentral/managedApis/azureeventgrid"
},
"outlook": {
"connectionId": "/subscriptions/<subscriptionId>/resourceGroups/PallabDev/providers/Microsoft.Web/connections/outlook",
"connectionName": "outlook",
"id": "/subscriptions/<subscriptionId>/providers/Microsoft.Web/locations/canadacentral/managedApis/outlook"
}
}
}
}
}

The reason is that the triggerbody is null, it needs to be an array, if it is null, it will cause your error.
According to the discussion in the comment area, turning off Split On can avoid this error.

Related

Send XML in message service bus and parse it in logic app

As I am a beginner on azue, I would like to know the procedure to follow for the following process:
sending an xml with a service bus message and receiving and parse it with logic app.
Thanks
I have used 2 logic apps in this case where 1 sends an XML message through the service bus and the other receives it.
The flow of Logic App - 1 (Sending XML message to Service bus)
The flow of Logic App - 2 (Receiving XML message from Service bus and parsing it)
You can convert XML to JSON and then use Parse_JSON to parse it.
RESULT:
Codeview of Logic app - 1
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Send_message": {
"inputs": {
"body": {
"ContentData": "#{base64(outputs('XML_Content'))}",
"SessionId": "#{utcNow()}"
},
"host": {
"connection": {
"name": "#parameters('$connections')['servicebus']['connectionId']"
}
},
"method": "post",
"path": "/#{encodeURIComponent(encodeURIComponent('queue1'))}/messages"
},
"runAfter": {
"XML_Content": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"XML_Content": {
"inputs": "<note>\n<to>Tove</to>\n<from>Jani</from>\n<heading>Reminder</heading>\n<body>Don't forget me this weekend!</body>\n</note>",
"runAfter": {},
"type": "Compose"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"servicebus": {
"connectionId": "/subscriptions/<SubId>/resourceGroups/<RG>/providers/Microsoft.Web/connections/servicebus-1",
"connectionName": "servicebus-1",
"id": "/subscriptions/<SubId>/providers/Microsoft.Web/locations/centralus/managedApis/servicebus"
}
}
}
}
}
Codeview of Logic app - 2
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "#json(xml(base64ToString(triggerBody()?['ContentData'])))",
"runAfter": {},
"type": "Compose"
},
"Parse_JSON": {
"inputs": {
"content": "#outputs('Compose')",
"schema": {
"properties": {
"note": {
"properties": {
"body": {
"type": "string"
},
"from": {
"type": "string"
},
"heading": {
"type": "string"
},
"to": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_message_is_received_in_a_queue_(auto-complete)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['servicebus_1']['connectionId']"
}
},
"method": "get",
"path": "/#{encodeURIComponent(encodeURIComponent('queue1'))}/messages/head",
"queries": {
"queueType": "Main"
}
},
"recurrence": {
"frequency": "Second",
"interval": 1
},
"type": "ApiConnection"
}
}
},
"parameters": {
"$connections": {
"value": {
"servicebus_1": {
"connectionId": "/subscriptions/<SubId>/resourceGroups/<RG>/providers/Microsoft.Web/connections/servicebus-2",
"connectionName": "servicebus-2",
"id": "/subscriptions/<SubId>/providers/Microsoft.Web/locations/centralus/managedApis/servicebus"
}
}
}
}
}

How do I parse Json file from azure blob storage to Azure Sql using Azure logic app

[][1]I have a multiple json files dropping in blob storage weekly, I want to use azure logic app to parse json file and copy data into Azure Sql? Please help
For achieving your requirement, Below are the flow that you can follow :-
Blob trigger (When a blob is added or modified (properties only) (V2)) >> Get blob content using path (V2) >> Parse JSON >> SQL related Action (For instance I'm using Insert row (V2)).
Below is the sample JSON that I'm uploading to my container.
{
"employees": {
"emp_name": "abc",
"hire_date": "2022-10-23",
"salary": 10000
}
}
I'm using triggers path to get the content of the blob. While Inserting the row I'm using Parse JSON values. Below is my Logic App.
Result:
UPDATED ANSWER
As per your requirement, you can either manually trigger flow using `` or set a recurrence trigger to make the flow triggered at times and then use list all files in that particular container from the storage account. Here is how the flow looks like
detailed flow
RESULTS:
code view of my logic app
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Get_blob_content_using_path_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/GetFileContentByPath",
"queries": {
"inferContentType": true,
"path": "#items('For_each')?['Path']",
"queryParametersSingleEncoded": true
}
},
"runAfter": {},
"type": "ApiConnection"
},
"Insert_row_(V2)": {
"inputs": {
"body": {
"emp_id": "#body('Parse_JSON')?['employees']?['employee_id']",
"emp_name": "#body('Parse_JSON')?['employees']?['emp_name']",
"hire_date": "#body('Parse_JSON')?['employees']?['hire_date']",
"salary": "#body('Parse_JSON')?['employees']?['salary']"
},
"host": {
"connection": {
"name": "#parameters('$connections')['sql']['connectionId']"
}
},
"method": "post",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('default'))},#{encodeURIComponent(encodeURIComponent('default'))}/tables/#{encodeURIComponent(encodeURIComponent('[dbo].[employees]'))}/items"
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Parse_JSON": {
"inputs": {
"content": "#json(body('Get_blob_content_using_path_(V2)'))",
"schema": {
"properties": {
"employees": {
"properties": {
"emp_name": {
"type": "string"
},
"employee_id": {
"type": "integer"
},
"hire_date": {
"type": "string"
},
"salary": {
"type": "integer"
}
},
"type": "object"
}
},
"type": "object"
}
},
"runAfter": {
"Get_blob_content_using_path_(V2)": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"foreach": "#body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent('JTJmY29udGFpbmVyMQ=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmY29udGFpbmVyMQ==": "/container1"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/<SUBSCRIPTION ID>/providers/Microsoft.Web/locations/centralus/managedApis/azureblob"
},
"sql": {
"connectionId": "/subscriptions/<SUBSCRIPTION ID>/resourceGroups/<RESOURCE GROUP NAME>/providers/Microsoft.Web/connections/sql",
"connectionName": "sql",
"id": "/subscriptions/<SUBSCRIPTION ID>/providers/Microsoft.Web/locations/centralus/managedApis/sql"
}
}
}
}
}

Trivial Azure Logic App fails when installed via ARM template

I created a trivial Azure Logic App workflow using the designer. The trigger is an Outlook.com connector When_a_new_email_arrives_(V2) that triggers when an email arrives at the configured account with logicapp1 in the subject line.
There is a single action configured which uses another Outlook.com connector Send_an_email_(V2). Both connectors use the same configured connection.
The workflow built in the designer works fine.
The Logic App and its connection are in a Resource Group by themselves. I export the app and connection from the Resource Group and then deploy it to a new Resource Group using the Azure CLI using the following commands:
az group create --name TestGroup1 --location uksouth
az deployment group create --resource-group TestGroup1 --template-file EmailIn-EmailOut.json
The logic app and its connection are correctly created in the new resource group and appear in the designer exactly the same as the original manually created app that works. The connection needs to be manually authenticated by opening it in the Azure Portal and entering the credentials, this is expected.
However the Logic App installed by the cli using the template does not respond to its trigger at all. Manually running the trigger from the Designer in the Azure Portal appears to just hang.
There is no indication given anywhere as to what is failing.
I've spent many hours Googling and trying various things, all to no avail. I don't know what else I can do to get to the bottom of this.
The complete template is included below. I would really appreciate any guidance at all.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_outlook_name": {
"defaultValue": "outlook",
"type": "String"
},
"workflows_EmailIn_EmailOut_name": {
"defaultValue": "EmailIn-EmailOut",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('connections_outlook_name')]",
"location": "uksouth",
"kind": "V1",
"properties": {
"displayName": "Outlook.com",
"api": {
"name": "[parameters('connections_outlook_name')]",
"displayName": "Outlook.com",
"description": "Outlook.com connector allows you to manage your mail, calendars, and contacts. You can perform various actions such as send mail, schedule meetings, add contacts, etc.",
"iconUri": "[concat('https://connectoricons-prod.azureedge.net/releases/v1.0.1559/1.0.1559.2723/', parameters('connections_outlook_name'), '/icon.png')]",
"brandColor": "#0078D4",
"id": "[concat('/subscriptions/d2e05926-6db6-4d9d-a091-6f4b5e03a2ec/providers/Microsoft.Web/locations/uksouth/managedApis/', parameters('connections_outlook_name'))]",
"type": "Microsoft.Web/locations/managedApis"
}
}
},
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('workflows_EmailIn_EmailOut_name')]",
"location": "uksouth",
"dependsOn": [
"[resourceId('Microsoft.Web/connections', parameters('connections_outlook_name'))]"
],
"properties": {
"state": "Enabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_new_email_arrives_(V2)": {
"splitOn": "#triggerBody()?['value']",
"type": "ApiConnectionNotification",
"inputs": {
"fetch": {
"method": "get",
"pathTemplate": {
"template": "/v2/Mail/OnNewEmail"
},
"queries": {
"folderPath": "Inbox",
"subjectFilter": "logicapp1"
}
},
"host": {
"connection": {
"name": "#parameters('$connections')['outlook']['connectionId']"
}
},
"subscribe": {
"body": {
"NotificationUrl": "#{listCallbackUrl()}"
},
"method": "post",
"pathTemplate": {
"template": "/MailSubscriptionPoke/$subscriptions"
},
"queries": {
"folderPath": "Inbox"
}
}
}
}
},
"actions": {
"Send_an_email_(V2)": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"body": {
"Body": "<p>The logic app executed successfully.</p>",
"Subject": "Logic App executed",
"To": "neutrino_sunset#hotmail.com"
},
"host": {
"connection": {
"name": "#parameters('$connections')['outlook']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
}
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"outlook": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('connections_outlook_name'))]",
"connectionName": "outlook",
"id": "/subscriptions/d2e05926-6db6-4d9d-a091-6f4b5e03a2ec/providers/Microsoft.Web/locations/uksouth/managedApis/outlook"
}
}
}
}
}
}
]
}
One work around would be that instead of defining the triggers and action in the Resource try defining them individually in the template
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Body": "<p><p>The logic app executed successfully.</p></p>",
"Subject": "Logic App executed",
"To": "neutrino_sunset#hotmail.com"
},
"host": {
"connection": {
"referenceName": "outlook"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"When_a_new_email_arrives_(V2)": {
"inputs": {
"fetch": {
"method": "get",
"pathTemplate": {
"template": "/v2/Mail/OnNewEmail"
},
"queries": {
"fetchOnlyWithAttachment": false,
"folderPath": "Inbox",
"importance": "Any",
"includeAttachments": false,
"subjectFilter": "app"
}
},
"host": {
"connection": {
"referenceName": "outlook"
}
},
"subscribe": {
"body": {
"NotificationUrl": "#{listCallbackUrl()}"
},
"method": "post",
"pathTemplate": {
"template": "/MailSubscriptionPoke/$subscriptions"
},
"queries": {
"fetchOnlyWithAttachment": false,
"folderPath": "Inbox",
"importance": "Any"
}
}
},
"splitOn": "#triggerBody()?['value']",
"type": "ApiConnectionNotification"
}
}
},
"kind": "Stateful"
}
Also along with this the logic app kind must be defined as stateful as the above triggers and actions are not available for stateless .

Send Email with multiple attachment using Azure Logic App

I need to send the blobs uploaded to my Azure storage container as an attachments. Number of files getting uploaded to container will change so I need to use dynamic method for attachment.
I have verified this question related to it
I am using below logic:
Append to variable values
{
"Name": items('For_each')?['DisplayName']
"ContentBytes":body('Get_blob_content')
}
When I am trying to save the logic, getting below error:
Save logic app failed
Failed to save logic app testing. The template validation failed: 'The action(s) 'Get_blob_content' referenced by 'inputs' in action 'Append_to_array_variable' are not defined in the template.'.
How can I solve this ?
Based on the error message shared above, Instead of saving the entire workflow at once would suggest you to save the logic app at each stage or before the appendtoarray variable stage & post then append the values to attachment variable with previous stage outputs.
Based on the above requirement, we have created the below logic app in our local environment &tested it as well which is working fine.
In our workflow, We have Used For Each to loop the blobs from List Blobs action. Within For Each you can use Get blob content to get blob content, and then use Append to array variable to append attachments.
The expressions Name and ContentBytes are as follows:
"ContentBytes": "#base64(body('Get_blob_content_(V2)'))",
"Name": "#items('For_each')?['DisplayName']"
Here is the code view of the Logic app that we have created :
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Append_to_array_variable": {
"inputs": {
"name": "attachments",
"value": {
"ContentBytes": "#base64(body('Get_blob_content_(V2)'))",
"Name": "#items('For_each')?['DisplayName']"
}
},
"runAfter": {
"Get_blob_content_(V2)": [
"Succeeded"
]
},
"type": "AppendToArrayVariable"
},
"Get_blob_content_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/#{encodeURIComponent(encodeURIComponent(items('For_each')?['Path']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "#body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Initialize_variable": [
"Succeeded"
]
},
"type": "Foreach"
},
"Initialize_variable": {
"inputs": {
"variables": [
{
"name": "attachments",
"type": "array"
}
]
},
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent('JTJmcmVwb3J0cw=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmcmVwb3J0cw==": "/reports"
},
"runAfter": {},
"type": "ApiConnection"
},
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Attachments": "#variables('attachments')",
"Body": "<p>tested logic app flow successfully</p>",
"Subject": "blob test",
"To": "<username>#microsoft.com"
},
"host": {
"connection": {
"name": "#parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_blob_is_added_or_modified_(properties_only)_(V2)": {
"evaluatedRecurrence": {
"frequency": "Minute",
"interval": 1
},
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/triggers/batch/onupdatedfile",
"queries": {
"checkBothCreatedAndModifiedDateTime": false,
"folderId": "JTJmcmVwb3J0cw==",
"maxFileCount": 10
}
},
"metadata": {
"JTJmcmVwb3J0cw==": "/reports"
},
"recurrence": {
"frequency": "Minute",
"interval": 1
},
"splitOn": "#triggerBody()",
"type": "ApiConnection"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/<sub-ID>/resourceGroups/<resourceGroup>/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/<sub-id>/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
},
"office365": {
"connectionId": "/subscriptions/<sub-id>/resourceGroups/<resroucegroup>/providers/Microsoft.Web/connections/office365",
"connectionName": "office365",
"id": "/subscriptions/<sub-id>/providers/Microsoft.Web/locations/eastus/managedApis/office365"
}
}
}
}
}
Here is the sample Output for reference:

How to deploy Logic App to Azure with ARM template that posts messages to Slack?

I am using the following ARM-template to make a Logic App that posts a message to Slack. However, when it gets deployed I get a Post-message "connection not found" (see image).
What is wrong with the template causing me to get connection not found?
{
"$schema":"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"parameters":{
"slack":{
"defaultValue":"",
"type":"Object"
}
},
"triggers":{
"manual":{
"inputs":{
"schema":{
"$schema":"http://json-schema.org/draft-04/schema#",
"properties":{
"context":{
"properties":{
"name":{
"type":"string"
},
"portalLink":{
"type":"string"
},
"resourceName":{
"type":"string"
}
},
"required":[
"name",
"portalLink",
"resourceName"
],
"type":"object"
},
"status":{
"type":"string"
}
},
"required":[
"status",
"context"
],
"type":"object"
}
},
"kind":"Http",
"type":"Request"
}
},
"actions":{
"Post_message":{
"runAfter":{
},
"type":"ApiConnection",
"inputs":{
"host":{
"connection":{
"name":"Hard-coded name here"
}
},
"method":"post",
"path":"/chat.postMessage",
"queries":{
"channel":"slack-channel-name",
"text":"This is a test :) "
}
}
}
},
"outputs":{
}
}
I am adding the parameters with a Python workflow-package in a separate script, imported from:
azure.mgmt.logic.models import Workflow
This seems to be working ok as the Logic App gets deployed just fine, it is only the connection that is missing.
This is occurring, because you have not created a Slack connector and added it's details in the Logic App. The Logic App ARM for this shall look something like:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Post_message": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['slack']['connectionId']"
}
},
"method": "post",
"path": "/chat.postMessage",
"queries": {
"channel": "C0N******UT",
"text": "Hello there!"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"slack": {
"connectionId": "/subscriptions/b8*******23f/resourceGroups/RG_NAME/providers/Microsoft.Web/connections/slack",
"connectionName": "slack",
"id": "/subscriptions/b83c1ed************4c23f/providers/Microsoft.Web/locations/westus2/managedApis/slack"
}
}
}
}
}
The slack connector should be added here:

Resources