简体   繁体   English

如何使用将消息发布到 Slack 的 ARM 模板将逻辑应用程序部署到 Azure?

[英]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.

相关问题 如何通过 Azure Devops CI/CD 使用单个 arm 模板部署多个逻辑应用程序? - How to deploy multiple logic app with single arm template via Azure Devops CI/CD? 如何在VSTS中将Azure Function应用程序代码与ARM模板一起部署 - How to deploy azure function app code along with ARM template in VSTS 部署时,Azure ARM模板逻辑应用程序授权OneDrive For Business帐户 - Azure ARM template Logic App authorize OneDrive For Business account when Deploy 如何从Azure存储中部署Arm模板? - How to deploy an arm template from Azure storage? 如何在 ARM 模板中使用 o365 连接器部署逻辑应用 - How to deploy Logic App with o365 Connector within ARM template 如何使用ARM(Azure资源管理器)部署具有SQL执行sp动作的Logic APP - How to deploy Logic APP that has SQL execute sp action using ARM( Azure Resource manager) 如何使用Azure市场中的ARM模板部署包含代码的Azure Function应用 - How to deploy Azure Function app including code using ARM template from Azure marketplace 通过 ARM 模板安装时,琐碎的 Azure 逻辑应用程序失败 - Trivial Azure Logic App fails when installed via ARM template Azure Logic应用-通过ARM模板创建Office365连接 - Azure Logic App - Office365 connection creation by ARM template 在 DevOps 中从 ARM 模板部署逻辑应用程序时如何创建到 Azure KeyVault 的 API 连接 - How can I create API connection to Azure KeyVault when deploying Logic App from ARM template in DevOps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM