DEV Community

Leonard Soetedjo
Leonard Soetedjo

Posted on

4 3

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.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay