Chitti
Chitti

Reputation: 49

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

I am fetching messages from service bus topic.
I want to parameterize the topic name here.
I tried

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

And concat() also I have tried but nothing is working.

Can someone please help me on this?

Upvotes: 1

Views: 697

Answers (1)

Thomas
Thomas

Reputation: 29736

If you don't want to deal with concat(), you should have a look at this article:

You can specify Logic App parameters which are different from ARM Template parameters.
So to summarize, you create an ARM parameter, a Logic App parameter then you map the ARM parameter to the Logic App parameter. It is a little bit complicated but you avoid using concat function.

So an ARM template should look like this:

{
  "$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": [

      ]
    }    
  ]
}

Upvotes: 2

Related Questions