azurevisual-studio-codeazure-functionsazure-logic-appsazure-logic-app-standard

Connecting to service bus from logic app standard workflow in vs code


I have a workflow with a service bus topic trigger:

"triggers": {
            "When_messages_are_available_in_a_topic": {
                "type": "ServiceProvider",
                "inputs": {
                    "parameters": {
                        "topicName": "sbt-intg-procman-dev-inbox",
                        "subscriptionName": "sbs-intg-procman-dev-inbox",
                        "isSessionsEnabled": false
                    },
                    "serviceProviderConfiguration": {
                        "connectionName": "serviceBus",
                        "operationId": "receiveTopicMessages",
                        "serviceProviderId": "/serviceProviders/serviceBus"
                    }
                },
                "splitOn": "@triggerOutputs()?['body']"
            }

My connections.json file contains the following:

{
  "serviceProviderConnections": {
    "serviceBus": {
      "displayName": "svcbus",
      "parameterSetName": "ManagedServiceIdentity",
      "parameterValues": {
        "authProvider": {
          "Type": "ManagedServiceIdentity"
        },
        "fullyQualifiedNamespace": "@appsetting('serviceBus_fullyQualifiedNamespace')"
      },
      "serviceProvider": {
        "id": "/serviceProviders/serviceBus"
      }
    }
  },
  "managedApiConnections": {}
}

I have a local.settings.json file with the following entry in the Values array:

"serviceBus_fullyQualifiedNamespace": "sb-mynamespace.servicebus.windows.net"

I've logged into the azure portal and checked that my user has appropriate role assignments on the service bus.

Using the Azure extension in VS Code, I have signed in as my user and selected the target subscription.

When I debug the subscription from VS Code, I get the following error:

Workflow Error: operationName='WorkflowFunctionDefinitionProvider.ProcessWorkflow', message='Workflow 'NvpOneWay' validation and creation failed. Error: 'The provided connection name 'serviceBus' for type 'ServiceProvider' has invalid 'authProvider' section. Managed identity is either not enabled or misconfigured on the Logic App. Please enable or repair managed identity before use.'', exception='Microsoft.Azure.Workflows.Common.ErrorResponses.ErrorResponseMessageException: The provided connection name 'serviceBus' for type 'ServiceProvider' has invalid 'authProvider' section. Managed identity is either not enabled or misconfigured on the Logic App. Please enable or repair managed identity before use

The logic app works ok when run in Azure, I'm just hitting the problem when trying to debug from VS Code. Any ideas?


Solution

  • Workflow Error: operationName='WorkflowFunctionDefinitionProvider.ProcessWorkflow', message='Workflow 'NvpOneWay' validation and creation failed. Error: 'The provided connection name 'serviceBus' for type 'ServiceProvider' has invalid 'authProvider' section. Managed identity is either not enabled or misconfigured on the Logic App. Please enable or repair managed identity before use.''

    You are getting this error because managed identity is not supported locally.

    You can refer to this github issue raised with the product team in order to add this feature for local development.

    You need to use connection string in Service Bus connector while working locally in vs code. Also, managed identity is only supported in Azure portal currently.

    While creating the connection in vs code if you choose managed identity in the designer then you will get below error post adding the required information in it.

    enter image description here

    Instead I chose connection string.

    enter image description here

    enter image description here

    By doing this, you can get this workflow running.

    enter image description here

    enter image description here