如何将参数传递给逻辑应用中的服务总线主题名称?

How to pass the parameter to the service bus topic name in the logic app?

我正在从服务总线主题中获取消息。
我想在这里参数化主题名称。
我试过了

"path": /@{encodeURIComponent(encodeURIComponent('[parameters('topicname')]'))}/messages",

concat() 我也试过了,但没有任何效果。

有人可以帮我解决这个问题吗?

如果你不想处理concat(),你应该看看这篇文章:

您可以指定 Logic App parameters,这与 ARM Template parameters 不同。
总而言之,您创建一个 ARM 参数,一个逻辑应用程序参数,然后将 ARM 参数映射到逻辑应用程序参数。它有点复杂,但你避免使用 concat 函数。

因此 ARM 模板应如下所示:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "topicname": {
      "type": "string",
      "metadata": {
        "description": "The name of the topic."
      }
    }
    ...   
  },
  "variables": {
  ...
  },
  "resources": [
    {
      "type": "Microsoft.Logic/workflows",
      "properties": {
        "definition": {
                ... 
                "path": "/@{encodeURIComponent(encodeURIComponent(parameters('topicname')))}/messages",
                ... 
          },
          "contentVersion": "1.0.0.0",
          "outputs": {},
          "parameters": {
            "$connections": {
              "defaultValue": {},
              "type": "Object"
            },
            "topicname": {
              "type": "String"
            }            
          }
        },
        "parameters": {
          "$connections": {
          ...
          },
          "topicname": {
            "value": "[parameters('topicname')]"
          },

        }
      },
      "dependsOn": [

      ]
    }    
  ]
}