Skip to content

connections.json has inconsistent string interpolation for managedApiConnections #683

@mrsmitty

Description

@mrsmitty

Describe the Bug

When managedApiConnections.<connection-name>.api.id and managedApiConnections.<connection-name>.connection.id are configured with @appsetting() expression with no surrounding text, the workflow experiences the following:

  • Designer in Azure loads and shows no error
  • Executing the workflow returns the following trace error in App Insights: ErrorResponseMessageException: The 'managedApiConnections' property in connection.json has a value that cannot be parsed.

When string interpolation is used for these two properties e.g. @{appsettings()}, with braces, execution of the workflow is successful.

This is the scenario that fails:

"managedApiConnections": {
    "office365": {
      "api": {
        "id": "@appsetting('O365AppId')"
      },
      "connection": {
        "id": "@appsetting('O365ConnectionId')"
      },
      "connectionRuntimeUrl": "@appsetting('O365ConnectionRuntimeUrl')",
      "authentication": {
        "type": "ManagedServiceIdentity"
      }
    }
  }

This scenario works. note, connectionRuntimeUrl accepts @appsettings(), only the id properties cause the error.

"managedApiConnections": {
    "office365": {
      "api": {
        "id": "/subscriptions/@{appsetting('WORKFLOWS_SUBSCRIPTION_ID')}/providers/Microsoft.Web/locations/@{appsetting('WORKFLOWS_LOCATION_NAME')}/managedApis/office365"
      },
      "connection": {
        "id": "/subscriptions/@{appsetting('WORKFLOWS_SUBSCRIPTION_ID')}/resourceGroups/@{appsetting('WORKFLOWS_RESOURCE_GROUP_NAME')}/providers/Microsoft.Web/connections/office365"
      },
      "connectionRuntimeUrl": "@appsetting('O365ConnectionRuntimeUrl')",
      "authentication": {
        "type": "ManagedServiceIdentity"
      }
    }
  }

Plan Type

Standard

Steps to Reproduce the Bug or Issue

  1. configure the connections.json file with @appsetting() references for managedApiConnections.<connection-name>.api.id and managedApiConnections.<connection-name>.connection.id
  2. Deploy the workflow
  3. Open the editor. Notice the connection is configured correctly
  4. Execute the workflow (e.g. HTTP trigger)
  5. Workflow execution fails

Workflow JSON

No response

Screenshots or Videos

No response

Additional context

extensionVersion='1.2.18.0'

Bicep snippit

param location string = resourceGroup().location
param subscriptionId string = subscription().subscriptionId

var o365ApiId = '/subscriptions/${subscriptionId}/providers/Microsoft.Web/locations/${location}/managedApis/office365'
var logicAppName = 'lap-syd-ais-dev-01'


resource office365Connection 'Microsoft.Web/connections@2016-06-01' = {
  name: 'office365'
  location: location
  kind: 'V2'
  properties: {
    api: {
      id: o365ApiId
    }
    displayName: 'Office 365 Outlook'
  }
}

var lapAppSettings = [
  {
    name: 'O365ConnectionRuntimeUrl'
    value: office365Connection.properties.connectionRuntimeUrl
  }
  {
    name: 'O365ApiId'
    value: o365ApiId
  }
  {
    name: 'O365ConnectionId'
    value: office365Connection.id
  }
]

resource logicApp 'Microsoft.Web/sites@2022-03-01' existing = {
  name: logicAppName
}

resource connectorAccessPolicy 'Microsoft.Web/Connections/accessPolicies@2016-06-01' = {
  name: '${logicAppName}-${guid(resourceGroup().name)}'
  parent: office365Connection
  properties: {
    principal: {
      type: 'ActiveDirectory'
      identity: {
        tenantId: subscription().tenantId
        objectId: logicApp.identity.principalId
      }
    }
  }
}

// update logic app with app settings

AB#16386512

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions