Skip to content

Workflow doesn't start if HTTP action has Managed Identity as authentication type #50

Open
@ronaldbosma

Description

@ronaldbosma

I have a workflow with an HTTP action. I'm using a Managed Identity for the authentication type. See the following sample:

Image

When I try to test my workflow with LogicAppUnit, I get the following error:

LogicAppUnit.TestException: Functions runtime did not start properly. 
Please make sure you have the latest Azure Functions Core Tools installed and available on your PATH environment variable, and that Azurite is running.

It seems that LogicAppUnit or the Azure Functions Core Tools can't start the workflow with this authentication type. This issue might be related to #49

When I change the authentication type on the HTTP action from ManagedServiceIdentity:

"authentication": {
    "type": "ManagedServiceIdentity",
    "audience": "api://sample-audience"
}

to None:

"authentication": {
    "type": "None",
    "audience": "api://sample-audience"
}

the test succeeds. I've created a fork with branch to reproduce the issue.

Repro steps:

  1. Checkout branch http-with-managed-identity-workflow on my fork: https://github.com/ronaldbosma/TestingFramework
  2. Start Azurite
  3. Execute the test HttpWithManagedIdentityWorkflowTest_When_Successful

The test fails and will produce the following output:

 HttpWithManagedIdentityWorkflowTest_When_Successful
   Source: HttpWithManagedIdentityWorkflowTest.cs line 36
   Duration: 2 min

  Message: 
Test method LogicAppUnit.Samples.LogicApps.Tests.HttpWithManagedIdentityWorkflow.HttpWithManagedIdentityWorkflowTest.HttpWithManagedIdentityWorkflowTest_When_Successful threw exception: 
LogicAppUnit.TestException: Functions runtime did not start properly. Please make sure you have the latest Azure Functions Core Tools installed and available on your PATH environment variable, and that Azurite is running.

  Stack Trace: 
WorkflowTestHost.StartFunctionRuntime() line 160
WorkflowTestHost.ctor(WorkflowTestInput[] inputs, String localSettings, String parameters, String connectionDetails, String host, CsxWrapper[] csxTestInputs, DirectoryInfo artifactsDirectory, DirectoryInfo customLibraryDirectory, Boolean writeFunctionRuntimeStartupLogsToConsole) line 56
TestRunner.ctor(TestConfigurationLogging loggingConfig, TestConfigurationRunner runnerConfig, HttpClient client, String host, List`1 mockResponsesFromBase, WorkflowDefinitionWrapper workflowDefinition, LocalSettingsWrapper localSettings, ParametersWrapper parameters, ConnectionsWrapper connections, CsxWrapper[] csxTestInputs, DirectoryInfo artifactsDirectory, DirectoryInfo customLibraryDirectory) line 196
WorkflowTestBase.CreateTestRunner(Dictionary`2 localSettingsOverrides) line 227
WorkflowTestBase.CreateTestRunner() line 204
HttpWithManagedIdentityWorkflowTest.HttpWithManagedIdentityWorkflowTest_When_Successful() line 38
RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

  Standard Output: 

--------------------------------------------------------------------------------
-                              INITIALIZING TEST                               -
--------------------------------------------------------------------------------

Azurite is listening on ports 10000 (Blob service), 10001 (Queue service) and 10002 (Table service).
Workflow 'http-with-managed-identity-workflow' is Stateful
Updating workflow HTTP actions to remove any existing Retry policies and replace with a 'none' policy:
    Get_Customers_from_Service_One
Using local settings file: local.settings.json
Updating local settings file for 'https://external-service-one.testing.net':
    ServiceOne-Url:
      https://external-service-one.testing.net/api/v1 ->
        http://ronaldb03:7075/api/v1
Updating local settings file for 'https://external-service-two.testing.net':
    ServiceTwo-Url:
      https://external-service-two.testing.net/api/v1.1 ->
        http://ronaldb03:7075/api/v1.1
    ServiceTwo-Verison2Url:
      https://external-service-two.testing.net/api/v2.0 ->
        http://ronaldb03:7075/api/v2.0
Updating connections file for managed API connectors:
    salesforce:
      @parameters('salesforce-ConnectionRuntimeUrl') ->
        http://ronaldb03:7075/apim/salesforce/fba515601ef14f9193eee596a9dcfd1c/
    outlook:
      @parameters('outlook-ConnectionRuntimeUrl') ->
        http://ronaldb03:7075/apim/outlook/79a0bc680716416e90e17323b581695d/
Using artifacts directory: LogicAppUnit.Samples.LogicApps\Artifacts
Using custom library directory: lib\custom

--------------------------------------------------------------------------------
-                             STARTING TEST RUNNER                             -
--------------------------------------------------------------------------------

Logging of the Function runtime startup logs is disabled. This can be enabled using the 'logging.writeFunctionRuntimeStartupLogs' option in 'testConfiguration.json'.
Path for Azure Function Core tools: C:\ProgramData\chocolatey\bin\func.exe
LogicAppUnit.TestException: Functions runtime did not start properly. Please make sure you have the latest Azure Functions Core Tools installed and available on your PATH environment variable, and that Azurite is running.
   at LogicAppUnit.Hosting.WorkflowTestHost.StartFunctionRuntime() in C:\repos\ronaldbosma\TestingFramework\src\LogicAppUnit\Hosting\WorkflowTestHost.cs:line 160

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions