1
votes

I have a logic app that is triggered by events from Azure Eventhub. Two environments are sending events to the same hub. I want to set environment specific URL based on the message from event hub. Environment can be either Fabrikam or Contoso.

Now I have tried to set both url's in template parameters. The variable is set to Contoso or Fabrikam right after the event, but the workflow definition parameter is not able to use variables('ApiBaseUrl')

Is there a way to set url environment this way?

Parameters file:

"Contoso": {
      "value": {
        "ApiBaseUrl": "https://contoso.azurewebsites.net/"
      }
"Fabrikam": {
      "value": {
        "ApiBaseUrl": "https://fabrikam.azurewebsites.net/"
      }

Logic app file:

"environment": {
            "value": {
              "ApiBaseUrl": "[parameters('variables('ApiBaseUrl')).ApiBaseUrl]"
            }
          }
1
Hi, may I know if the solution provided below works ? If still have any problem, please let me know. - Hury Shen

1 Answers

1
votes

If I understand you correctly, you want to use the value of the variable as the key of the parameter to get the parameter value. Now the code of your parameter should be like:

"parameters": {
    "Contoso": {
      "value": {
        "ApiBaseUrl": "https://contoso.azurewebsites.net/"
    }
}

Please modify the parameters code above to:

"parameters": {
    "Contoso": {
        "defaultValue": "https://contoso.azurewebsites.net/",
        "type": "String"
    }
}

Then you can just use parameters(variables('ApiBaseUrl')) to get the result you want.

enter image description here