DEV Community

Leonard Soetedjo
Leonard Soetedjo

Posted on

Parameterising Logic App (Standard) connections.json with bicep - Part 1

Yet another issue I found when dealing with Logic App in Azure. This time, I want to parameterise the connections.json with the values from appsettings. Specifically, it's the managedApiConnections section of connections.json as this requires a particularly new item: connectionRuntimeUrl.

...
"managedApiConnections": {
  "azureblob_1": {
    "api": {
      "id": "/subscriptions/xxxxxxxxxx/providers/Microsoft.Web/locations/xxxxxxxxxx/managedApis/azureblob"
    },
      "authentication": {
        "type": "ManagedServiceIdentity"
      },
      "connection": {
        "id": "/subscriptions/xxxxxxxxxx/resourceGroups/xxxxxxxxxx/providers/Microsoft.Web/connections/azureblob"
      },
      "connectionRuntimeUrl": "https://xxxxxxxxxx.azure-apihub.net/apim/azureblob/xxxxxxxxxx"
    }
}
...
Enter fullscreen mode Exit fullscreen mode

Looking around Microsoft's documentation on Web Connections, there don't "seem" much useful info on the list of parameters that it requires to build the connections in bicep. However, if we go down further, there're quickstart templates that we can refer to for storage or service bus queue.

As we'll be building in bicep, we start with decompiling (az bicep decompile --file azuredeploy.json) the ARM template into bicep and try to analyse what's required.

resource serviceBusConnectionName_resource 'Microsoft.Web/connections@2018-07-01-preview' = {
  location: location
  name: serviceBusConnectionName
  properties: {
    api: {
      id: subscriptionResourceId('Microsoft.Web/locations/managedApis', location, 'servicebus')
    }
    displayName: 'servicebus'
    parameterValues: {
      connectionString: serviceBusConnectionString
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Of interest is the item under parameterValues as it's not documented. With this, we can retrieve the service bus connection string and put it into the bicep script. Do note that the above bicep is only for service bus. We can use the other quickstart template for other resources such as azure blob which will show us a different set of required parameterValues to build the bicep script.

Once we've the above, the next step is then to update the Logic App (Standard) connections.json to retrieve the necessary information from e.g. appsettings. This is another journey into the uncharted which I will cover in the next post.

Top comments (0)