如何在 ARM 模板中为服务总线逻辑应用程序操作设置连接字符串? [英] How to set the connection string for a Service Bus Logic App action in an ARM template?

查看:27
本文介绍了如何在 ARM 模板中为服务总线逻辑应用程序操作设置连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署一个 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.

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,并且队列连接器"引用了 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 模板中为服务总线逻辑应用程序操作设置连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆