Table of Contents

Class ManagedIdentityApplication

Namespace
Microsoft.Identity.Client
Assembly
Microsoft.Identity.Client.dll

Class to be used for managed identity applications (on Azure resources like App Services, Virtual Machines, Azure Arc, Service Fabric and Cloud Shell).

public sealed class ManagedIdentityApplication : ApplicationBase, IManagedIdentityApplication, IApplicationBase
Inheritance
ManagedIdentityApplication
Implements
Inherited Members

Remarks

Managed identity can be enabled on Azure resources as a system assigned managed identity or a user assigned managed identity.

Methods

AcquireTokenForManagedIdentity(string)

Acquires token for a managed identity configured on Azure resource. See https://aka.ms/msal-net-managed-identity.

public AcquireTokenForManagedIdentityParameterBuilder AcquireTokenForManagedIdentity(string resource)

Parameters

resource string

resource requested to access the protected API. For this flow (managed identity), the resource should be of the form "{ResourceIdUri}" or {ResourceIdUri/.default} for instance https://management.azure.net or, for Microsoft Graph, https://graph.microsoft.com/.default.

Returns

AcquireTokenForManagedIdentityParameterBuilder

A builder enabling you to add optional parameters before executing the token request

Remarks

You can also chain the following optional parameters: WithForceRefresh(bool)

GetManagedIdentitySource()

Detects and returns the managed identity source available on the environment.

public static ManagedIdentitySource GetManagedIdentitySource()

Returns

ManagedIdentitySource

Managed identity source detected on the environment if any.