AbstractAcquireTokenParameterBuilder<T>.WithAuthority Method

Definition

Overloads

WithAuthority(String, String, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) described by its domain name. See https://aka.ms/msal-net-application-configuration.

WithAuthority(String, Guid, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) specified by its tenant ID. See https://aka.ms/msal-net-application-configuration.

WithAuthority(AzureCloudInstance, String, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) described by its cloud instance and its domain name or tenant ID. See https://aka.ms/msal-net-application-configuration.

WithAuthority(AzureCloudInstance, Guid, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) described by its cloud instance and its tenant ID. See https://aka.ms/msal-net-application-configuration.

WithAuthority(AzureCloudInstance, AadAuthorityAudience, Boolean)

Adds a known Azure AD authority to the application to sign-in users specifying the cloud instance and the sign-in audience. See https://aka.ms/msal-net-application-configuration.

WithAuthority(String, Boolean)

Specific authority for which the token is requested. Passing a different value than configured at the application constructor narrows down the selection to a specific tenant. This does not change the configured value in the application. This is specific to applications managing several accounts (like a mail client with several mailboxes). See https://aka.ms/msal-net-application-configuration.

WithAuthority(AadAuthorityAudience, Boolean)

Adds a known Azure AD authority to the application to sign-in users specifying the sign-in audience (the cloud being the Azure public cloud). See https://aka.ms/msal-net-application-configuration.

WithAuthority(String, String, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) described by its domain name. See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (string cloudInstanceUri, string tenant, bool validateAuthority = true);
member this.WithAuthority : string * string * bool -> 'T
Public Function WithAuthority (cloudInstanceUri As String, tenant As String, Optional validateAuthority As Boolean = true) As T

Parameters

cloudInstanceUri
System.String

Uri to the Azure Cloud instance (for instance https://login.microsoftonline.com).

tenant
System.String

Tenant Id associated with the tenant from which to sign-in users.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Remarks

tenant can also contain the string representation of a GUID (tenantId), or even common, organizations or consumers but in this case it's recommended to use another override (WithAuthority(AzureCloudInstance, Guid, Boolean) and WithAuthority(AzureCloudInstance, AadAuthorityAudience, Boolean)

Applies to

WithAuthority(String, Guid, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) specified by its tenant ID. See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (string cloudInstanceUri, Guid tenantId, bool validateAuthority = true);
member this.WithAuthority : string * Guid * bool -> 'T
Public Function WithAuthority (cloudInstanceUri As String, tenantId As Guid, Optional validateAuthority As Boolean = true) As T

Parameters

cloudInstanceUri
System.String

Azure Cloud instance.

tenantId
System.Guid

GUID of the tenant from which to sign-in users.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Applies to

WithAuthority(AzureCloudInstance, String, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) described by its cloud instance and its domain name or tenant ID. See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (Microsoft.Identity.Client.AzureCloudInstance azureCloudInstance, string tenant, bool validateAuthority = true);
member this.WithAuthority : Microsoft.Identity.Client.AzureCloudInstance * string * bool -> 'T
Public Function WithAuthority (azureCloudInstance As AzureCloudInstance, tenant As String, Optional validateAuthority As Boolean = true) As T

Parameters

azureCloudInstance
AzureCloudInstance

Instance of Azure Cloud (for instance Azure worldwide cloud, Azure German Cloud, US government ...).

tenant
System.String

Tenant Id of the tenant from which to sign-in users. This can also be a GUID.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Applies to

WithAuthority(AzureCloudInstance, Guid, Boolean)

Adds a known Azure AD authority to the application to sign-in users from a single organization (single tenant application) described by its cloud instance and its tenant ID. See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (Microsoft.Identity.Client.AzureCloudInstance azureCloudInstance, Guid tenantId, bool validateAuthority = true);
member this.WithAuthority : Microsoft.Identity.Client.AzureCloudInstance * Guid * bool -> 'T
Public Function WithAuthority (azureCloudInstance As AzureCloudInstance, tenantId As Guid, Optional validateAuthority As Boolean = true) As T

Parameters

azureCloudInstance
AzureCloudInstance

Instance of Azure Cloud (for instance Azure worldwide cloud, Azure German Cloud, US government ...).

tenantId
System.Guid

Tenant Id of the tenant from which to sign-in users.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Applies to

WithAuthority(AzureCloudInstance, AadAuthorityAudience, Boolean)

Adds a known Azure AD authority to the application to sign-in users specifying the cloud instance and the sign-in audience. See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (Microsoft.Identity.Client.AzureCloudInstance azureCloudInstance, Microsoft.Identity.Client.AadAuthorityAudience authorityAudience, bool validateAuthority = true);
member this.WithAuthority : Microsoft.Identity.Client.AzureCloudInstance * Microsoft.Identity.Client.AadAuthorityAudience * bool -> 'T
Public Function WithAuthority (azureCloudInstance As AzureCloudInstance, authorityAudience As AadAuthorityAudience, Optional validateAuthority As Boolean = true) As T

Parameters

azureCloudInstance
AzureCloudInstance

Instance of Azure Cloud (for instance Azure worldwide cloud, Azure German Cloud, US government ...).

authorityAudience
AadAuthorityAudience

Sign-in audience (one AAD organization, any work and school accounts, or any work and school accounts and Microsoft personal accounts.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Applies to

WithAuthority(String, Boolean)

Specific authority for which the token is requested. Passing a different value than configured at the application constructor narrows down the selection to a specific tenant. This does not change the configured value in the application. This is specific to applications managing several accounts (like a mail client with several mailboxes). See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (string authorityUri, bool validateAuthority = true);
member this.WithAuthority : string * bool -> 'T
Public Function WithAuthority (authorityUri As String, Optional validateAuthority As Boolean = true) As T

Parameters

authorityUri
System.String

Uri for the authority. In the case when the authority URI is a known Azure AD URI, this setting needs to be consistent with what is declared in the application registration portal.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Applies to

WithAuthority(AadAuthorityAudience, Boolean)

Adds a known Azure AD authority to the application to sign-in users specifying the sign-in audience (the cloud being the Azure public cloud). See https://aka.ms/msal-net-application-configuration.

public T WithAuthority (Microsoft.Identity.Client.AadAuthorityAudience authorityAudience, bool validateAuthority = true);
member this.WithAuthority : Microsoft.Identity.Client.AadAuthorityAudience * bool -> 'T
Public Function WithAuthority (authorityAudience As AadAuthorityAudience, Optional validateAuthority As Boolean = true) As T

Parameters

authorityAudience
AadAuthorityAudience

Sign-in audience (one AAD organization, any work and school accounts, or any work and school accounts and Microsoft personal accounts.

validateAuthority
System.Boolean

Whether the authority should be validated against the server metadata.

Returns

T

The builder to chain the .With methods.

Applies to