Coder Perfect

Using the Connection Runtime Url, create an Azure Connection API.


I have a logic application (a normal logic application) that connects to Cosmos DB. I need to save the “Connection Runtime Url” in the logic App’s configuration.

This property is present when I establish a connection via the logic app designer. When I use an ARM template to deploy the same connection, however, it does not have this feature.

Anyone knows how can get this property or generate it? And if possible, how to call it later in an ARM template


Asked by ibda

Solution #1

A simple API connection (V1) may not have “connectionRuntimeUrl,” according to this discussion. So, in order to see it, I’ll have to add

            "kind": "V2",

in my connection template, as @Thomas mentioned in his response

Answered by ibda

Solution #2

A connection can only be returned if the API connection type is ‘V2.’ RuntimeUrl.

The following script (bicep) can be used to construct a Cosmos db connector:

param location string = resourceGroup().location
param cosmosDbAccountName string
param connectorName string = '${cosmosDbAccountName}-connector'

// get a reference to the cosmos db account
resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' existing = {
  name: cosmosDbAccountName

// create the related connection api
resource cosmosDbConnector 'Microsoft.Web/connections@2016-06-01' = {
  name: connectorName
  location: location
  kind: 'V2'
  properties: {
    displayName: connectorName
    parameterValues: {
      accessKey: listKeys(, cosmosDbAccount.apiVersion).primaryMasterKey
    api: {
      id: 'subscriptions/${subscription().subscriptionId}/providers/Microsoft.Web/locations/${location}/managedApis/documentdb'

output connectionRuntimeUrl string = reference(, cosmosDbConnector.apiVersion, 'full').properties.connectionRuntimeUrl

The created ARM’s output will be the URI. Then, in the workflow app, add this website as an appsetting:


Then you may refer to this app configuration in the connections.json file:

  "managedApiConnections": {
    "documentdb": {
      "connectionRuntimeUrl": "@appsetting('COSMOS_CONNECTION_RUNTIMEURL')"

Using appsettings and parameters should make thing easier to deploy

Answered by Thomas

Post is based on