[英]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.我正在使用以下 ARM 模板制作一个向 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:我在一个单独的脚本中添加带有 Python 工作流包的参数,从以下位置导入:
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.发生这种情况是因为您尚未创建Slack connector
并将其详细信息添加到逻辑应用程序中。 The Logic App ARM for this shall look something like:逻辑应用程序 ARM 应如下所示:
{
"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:应在此处添加松弛连接器:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.