本文介绍了如何在ARM模板中为Service Bus Logic App操作设置连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试部署Azure逻辑应用程序,其中包括使用ARM模板在服务总线上发送消息的操作.

I'm attempting to deploy an Azure Logic App that includes an action to Send a message on a Service Bus using an ARM template.

除了部署Logic App外,ARM模板还部署了服务总线命名空间,一个队列和两个AuthorizationRule(一个用于发送,一个用于侦听).

In addition to deploying the Logic App, the ARM template deploys a Service Bus Namespace, a Queue and two AuthorizationRule (one for sending and one for listening).

我想动态设置发送服务总线消息"操作的连接信息,以使用为支持发送的AuthorizationRule生成的连接字符串.

I want to dynamically set the connection information for the Send Service Bus Message action to use the Connection string generated for the AuthorizationRule that supports sending.

当我在门户网站编辑器中创建此文件(指定要发送的连接字符串)时,我注意到在代码视图中生成了以下内容...

When I create this in the portal editor (specifying the connection string for sending), I noticed the following is generated in code view...

"Send_message.": {
    "conditions": [
        {
            "dependsOn": "<previous action>"
        }
    ],
    "inputs": {
        "body": {
            "ContentData": "@{encodeBase64(triggerBody())}"
        },
        "host": {
            "api": {
                "runtimeUrl": "https://logic-apis-westus.azure-apim.net/apim/servicebus"
            },
            "connection": {
                "name": "@parameters('$connections')['servicebus']['connectionId']"
            }
        },
        "method": "post",
        "path": "/@{encodeURIComponent(string('<queuename>'))}/messages"
    },
    "type": "apiconnection"
}

},

我认为连接信息某种程度上埋在了@parameters('$connections')['servicebus']['connectionId']"

I assume that the connection information is somehow buried in @parameters('$connections')['servicebus']['connectionId']"

然后,我使用 resources.azure.com 导航至逻辑应用程序,以查看是否可以获得更多信息@parameters('$connections')['servicebus']['connectionId']"的定义方式的详细信息.

I then used resources.azure.com to navigate to the logic app to see if I could get more details as to how @parameters('$connections')['servicebus']['connectionId']" is defined.

我发现了:

"parameters": {
  "$connections": {
    "value": {
      "servicebus": {
        "connectionId": "/subscriptions/<subguid>/resourceGroups/<rgname>/providers/Microsoft.Web/connections/servicebus",
        "connectionName": "servicebus",
        "id": "/subscriptions/<subguid>/providers/Microsoft.Web/locations/westus/managedApis/servicebus"
      }
    }
  }
}

但是我仍然看不到设置连接字符串的位置.

But I still don't see where the connection string is set.

我可以在哪里使用以下类似方法在ARM模板中设置服务总线操作的连接字符串?

Where can I set the connection string for the service bus action in an ARM template using something like the following?

[listkeys(variables('sendAuthRuleResourceId'), variables('sbVersion')).primaryConnectionString]

另外,我提到的似乎是在github上有前途的Azure快速入门(基于标题),但我对此毫无意义.它似乎使用了较旧的架构2014-12-01-preview,并且"queueconnector"引用了Api网关.如果有这种情况下的新示例,我很乐意看到它.

Also, I've referred to was seems to be a promising Azure quick start on github (based on the title), but I can't make any sense of it. It appears to use an older schema 2014-12-01-preview, and the "queueconnector" references an Api Gateway. If there is a newer example out there for this scenario, I'd love to see it.

推荐答案

您知道连接是一种资源,因此需要首先创建此连接吗?您是否引用了此 https://blogs.msdn.microsoft.com/logicapps/2016/02/23/deploying-in-the-logic-apps-preview-refresh/.您指的快速入门链接适用于较旧的架构.

As you know connections is a resource so it needs to be created first did you refer this https://blogs.msdn.microsoft.com/logicapps/2016/02/23/deploying-in-the-logic-apps-preview-refresh/. Quick start link you are referring is for older schema.

这篇关于如何在ARM模板中为Service Bus Logic App操作设置连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:41