Language

MsalManagedIdentityException Class

Definition

Caution

MsalManagedIdentityException is deprecated and will be removed in a future release. Catch MsalServiceException instead.

This exception class is for exceptions generated from Managed Identity sources. This class is deprecated and will be removed in a future release. Catch MsalServiceException instead. For more details, see https://aka.ms/msal-net-managed-identity

[System.Obsolete("MsalManagedIdentityException is deprecated and will be removed in a future release. Catch MsalServiceException instead.", true)]
public class MsalManagedIdentityException : Microsoft.Identity.Client.MsalServiceException
[<System.Obsolete("MsalManagedIdentityException is deprecated and will be removed in a future release. Catch MsalServiceException instead.", true)>]
type MsalManagedIdentityException = class
    inherit MsalServiceException
Public Class MsalManagedIdentityException
Inherits MsalServiceException
Inheritance
MsalManagedIdentityException
Attributes

Constructors

Name Description
MsalManagedIdentityException(String, String, Exception, ManagedIdentitySource, Int32)

Initializes a new instance of the exception class with a specified error code, error message and managed identity source.

MsalManagedIdentityException(String, String, Exception, ManagedIdentitySource)

Initializes a new instance of the exception class with a specified error code, error message and managed identity source.

MsalManagedIdentityException(String, String, ManagedIdentitySource, Int32)

Initializes a new instance of the exception class with a specified error code, error message and inner exception indicating the root cause.

MsalManagedIdentityException(String, String, ManagedIdentitySource)

Initializes a new instance of the exception class with a specified error code, error message and inner exception indicating the root cause.

Fields

Name Description
AuthenticationResultMetadataKey

A key on Data under which MSAL stores the AuthenticationResultMetadata captured when a token acquisition fails with a non-MsalException. Lets downstream consumers surface token-acquisition diagnostics even though the originating exception is re-thrown unchanged.

(Inherited from MsalException)
BrokerErrorCode

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerErrorContext

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerErrorStatus

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerErrorTag

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)
BrokerTelemetry

An AdditionalExceptionData property key, available when using desktop brokers.

(Inherited from MsalException)

Properties

Name Description
AdditionalExceptionData

A property bag with extra details for this exception.

(Inherited from MsalException)
AuthenticationResultMetadata

Diagnostic metadata for the failed token-acquisition attempt — the total duration and, when the relevant stage ran, HTTP/cache durations, token endpoint, and region used. This is null when the exception was thrown before the request pipeline started collecting metadata (for example, parameter or builder validation). When it is non-null — the typical in-request failure — DurationTotalInMs is always populated (useful for latency measurement), while the other fields may be 0/null when the corresponding stage did not run. On a failure TokenSource has no meaningful value and should not be relied on. Reuses the type returned by AuthenticationResultMetadata on the success path.

(Inherited from MsalException)
Claims

Additional claims requested by the service. When this property is not null or empty, this means that the service requires the user to provide additional claims, such as doing two factor authentication. The are two cases:

For more details see https://aka.ms/msal-net-claim-challenge (Inherited from MsalServiceException)
CorrelationId

An ID that can used to piece up a single authentication flow.

(Inherited from MsalException)
ErrorCode

Gets the protocol error code returned by the service or generated by the client. This is the code you can rely on for exception handling. Values for this code are typically provided in constant strings in the derived exceptions types with explanations of mitigation.

(Inherited from MsalException)
ErrorCodesForLogging

The list of STS-specific error codes returned by the token service (for example the numeric AADSTS codes such as 50076, 50079) that refine ErrorCode. Values are emitted by the service and may change without notice; intended for diagnostics and logging — do not branch production behavior on this value. Returns null when the service did not supply error codes.

(Inherited from MsalServiceException)
Headers

Contains the HTTP headers from the server response that indicated an error.

(Inherited from MsalServiceException)
IsRetryable

Indicates if the previous operation that resulted in this exception should be retried.

(Inherited from MsalException)
ManagedIdentitySource

Specifies the managed identity source from which the exception initiates.

ResponseBody

Raw response body received from the server.

(Inherited from MsalServiceException)
StatusCode

Gets the status code returned from HTTP layer. This status code is either the HttpStatusCode in the inner HttpRequestException response or the NavigateError Event Status Code in a browser based flow (see NavigateError Event Status Codes). You can use this code for purposes such as implementing retry logic or error investigation.

(Inherited from MsalServiceException)
SubErrorForLogging

Sub-error returned by the token service refining ErrorCode (for example consent_required, bad_token, protection_policy_required). Values are emitted by the service and may change without notice; intended for diagnostics and logging — do not branch production behavior on this value.

(Inherited from MsalServiceException)

Methods

Name Description
ToJsonString()

Allows serialization of most values of the exception into JSON.

(Inherited from MsalException)
ToString()

Creates and returns a string representation of the current exception.

(Inherited from MsalServiceException)
UpdateIsRetryable()

Retry error codes specific to managed identity

Applies to