Table of Contents

Class AccountId

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

An identifier for an account in a specific tenant. Returned by IAccount.HomeAccountId

public class AccountId
Inheritance
AccountId
Inherited Members

Constructors

AccountId(string)

Constructor of an AccountId meant for Active Directory Federation Services (ADFS) scenarios since ADFS instances lack tenant IDs.

public AccountId(string adfsIdentifier)

Parameters

adfsIdentifier string

Unique identifier for the account if authority is ADFS.

AccountId(string, string, string)

Constructor for an account ID.

public AccountId(string identifier, string objectId, string tenantId)

Parameters

identifier string

Unique identifier for the account.

objectId string

A string representation for a GUID which is the ID of the user owning the account in the tenant.

tenantId string

A string representation for a GUID which is the ID of the tenant where the account resides.

Properties

Identifier

Unique identifier for the account

public string Identifier { get; }

Property Value

string

Remarks

For the Microsoft identity platform (formerly named Azure AD v2.0), the identifier is the concatenation of ObjectId and TenantId separated by a period. Unlike in ADAL.NET, these two segments are no longer base64-encoded. Note that there are some legitimate cases (for instance domain takeover) where the same ObjectId may show up in multiple tenants.

ObjectId

For Microsoft Entra ID, a string representation for a GUID which is the object ID of the user owning the account in the tenant

public string ObjectId { get; }

Property Value

string

TenantId

For Microsoft Entra ID, a string representation for a GUID which is the ID of the tenant where the account resides.

public string TenantId { get; }

Property Value

string

Methods

Equals(object)

Two accounts are equal when their Identifier properties match.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

GetHashCode implementation to match Equals(object).

public override int GetHashCode()

Returns

int

ToString()

Textual description of an AccountId.

public override string ToString()

Returns

string