1
votes

I am building a Logic App with connection to Service Bus. I created the Logic App and the API Connection. To the API connection I added the Service Bus RootManageSharedAccessKey primary connection string. I can use that API connection in the Trigger action of new message appearing in the queue.

Now, if I load the logic app to Visual Studio and deploy it from there (using the Resource Group project type) it asks for the Service Bus connection string.

enter image description here

In the above picture I have used the keyvault. It creates following LogicApp.parameters.json:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "logicAppName": {
      "value": "publisher-la-messagebatcher-test"
    },
    "servicebus_1_connectionString": {
      "reference": {
        "keyVault": {
          "id": "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.KeyVault/vaults/publisher-kvault-test"
        },
        "secretName": "servicebus-connection-string"
      }
    }
  }
}

Now, my question is why do I have to provide the connection string again in the logic app deployment parameters for the API connection (in this case "publisher-sb-test-connection")? Isn't it enough that the connection itself (in Azure) is configured to use the connection string? Can I bypass defining the connection string in the logic app deployment?

1

1 Answers

0
votes

Well, I found it. Visual Studio creates the API connection also to the template. Open the LogicApp.json and remove the servicebus_1_connectionString resource creation logic.

"servicebus_1_connectionString": {
  "type": "securestring",
  "metadata": {
    "description": "Azure Service Bus Connection String"
  }
},
---
  "dependsOn": [
    "[resourceId('Microsoft.Web/connections', parameters('servicebus_1_Connection_Name'))]"
  ]
},
{
  "type": "MICROSOFT.WEB/CONNECTIONS",
  "apiVersion": "2016-06-01",
  "name": "[parameters('servicebus_1_Connection_Name')]",
  "location": "westeurope",
  "properties": {
    "api": {
      "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', 'westeurope', '/managedApis/', 'servicebus')]"
    },
    "displayName": "[parameters('servicebus_1_Connection_DisplayName')]",
    "parameterValues": {
      "connectionString": "[parameters('servicebus_1_connectionString')]"
    }
  }