Skip to content

[FEATURE REQ] Provide ManagedIdentityCredentialOptions.ExcludeWorkloadIdentityCredential boolean option #49212

Open
@dgkanatsios

Description

@dgkanatsios

Library name

Azure.Identity

Please describe the feature.

We are currently trying to use the feature described here which essentially allows you to use a Managed Identity (MI) to authenticate towards an Azure Active Directory app registration. However, in case this MI is also used as a Workload Identity in an AKS cluster, we cannot use the ManagedIdentityCredential class as described in the blog post.

Reason is that in the current Azure.Identity implementation, if you use ManagedIdentityCredential or WorkloadIdentityCredential, you'll get the workload identity token (https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ManagedIdentityClient.cs#L127)). This token, however, is already a federated identity token so it cannot be used for token exchange again, since this is FIC chaining which is not allowed by AAD.

The workaround right now is to use DefaultAzureCredentials in this way

 var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions()
        {
            ExcludeWorkloadIdentityCredential = true,
            ExcludeEnvironmentCredential = true,
            ManagedIdentityClientId = miClientId
        });

However, DefaultAzureCredentials should not be used in production as per guidance so it would be great if we have this support in the ManagedIdentityCredential class.

Update: this is the error message one would get

ClientAssertionCredential authentication failed: A configuration issue is preventing authentication - check the error message from the server for 
details. You can modify the configuration in the application registration portal. See https://aka.ms/msal-net-invalid-client for details.  Original exception: AADSTS700231: Token obtained using a federated identity credential may    
not be used as a federated identity credential

Metadata

Metadata

Assignees

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions