Skip to content

Add workload identity as a MSAL option #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 20, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ public enum AuthTypes
ClientSecret,
UserManagedIdentity,
SystemManagedIdentity,
FederatedCredentials
FederatedCredentials,
WorkloadIdentity
}
}
Original file line number Diff line number Diff line change
@@ -146,6 +146,16 @@ public void ValidateConfiguration()
throw new ArgumentNullException(nameof(Authority), "TenantId or Authority is required");
}
break;
case AuthTypes.WorkloadIdentity:
if (string.IsNullOrEmpty(ClientId))
{
throw new ArgumentNullException(nameof(ClientId), "ClientId is required");
}
if (string.IsNullOrEmpty(Authority) && string.IsNullOrEmpty(TenantId))
{
throw new ArgumentNullException(nameof(Authority), "TenantId or Authority is required");
}
break;
default:
break;
}
Original file line number Diff line number Diff line change
@@ -225,6 +225,10 @@ async Task<String> FetchExternalTokenAsync()
}
cAppBuilder.WithClientAssertion((AssertionRequestOptions options) => FetchExternalTokenAsync());
}
else if (_connectionSettings.AuthType == AuthTypes.WorkloadIdentity)
{
// No need to do anything more, MSAL will resolve everything for WorkloadIdentity
}
else
{
throw new System.NotImplementedException();