Skip to content

Commit 4c36cca

Browse files
committed
Update all HTTP actions with authentication type ManagedServiceIdentity to use None as the authentication type.
1 parent 3222899 commit 4c36cca

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/LogicAppUnit/WorkflowTestBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ private void ProcessWorkflowDefinitionFile(string logicAppBasePath, string workf
267267
_workflowDefinition.ReplaceInvokeWorkflowActionsWithHttp();
268268
_workflowDefinition.ReplaceCallLocalFunctionActionsWithHttp();
269269
_workflowDefinition.ReplaceBuiltInConnectorActionsWithHttp(_testConfig.Workflow.BuiltInConnectorsToMock);
270+
_workflowDefinition.ReplaceManagedIdentityAuthenticationTypeWithNone();
270271
}
271272

272273
/// <summary>

src/LogicAppUnit/Wrapper/WorkflowDefinitionWrapper.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,5 +296,29 @@ public void ReplaceCallLocalFunctionActionsWithHttp()
296296
});
297297
}
298298
}
299+
300+
/// <summary>
301+
/// Update all HTTP actions with authentication type <i>ManagedServiceIdentity</i> to use <i>None</i> as the authentication type.
302+
/// </summary>
303+
/// <remarks>
304+
/// The <i>ManagedServiceIdentity</i> is not supported.
305+
/// </remarks>
306+
public void ReplaceManagedIdentityAuthenticationTypeWithNone()
307+
{
308+
var httpActionsWithManagedIdentityAuthenticationType = _jObjectWorkflow.SelectTokens("$..actions.*").Where(x => x["type"].ToString() == "Http")
309+
.Where(x => x["inputs"]?["authentication"]?["type"].ToString() == "ManagedServiceIdentity").Select(x => x["inputs"]?["authentication"] as JObject).ToList();
310+
311+
if (httpActionsWithManagedIdentityAuthenticationType.Count > 0)
312+
{
313+
Console.WriteLine("Updating workflow HTTP actions to replace authentication type `ManagedServiceIdentity` with `None`:");
314+
315+
httpActionsWithManagedIdentityAuthenticationType.ForEach(x =>
316+
{
317+
x["type"] = "None";
318+
319+
Console.WriteLine($" {((JProperty)x.Parent.Parent.Parent.Parent.Parent).Name}");
320+
});
321+
}
322+
}
299323
}
300324
}

0 commit comments

Comments
 (0)