Difference Between Azure.Identity and Microsoft.Identity.Client Namespace

Karl Gardner 195 Reputation points
2024-07-14T18:19:27.91+00:00

Hello,

I am wondering what the difference is between these two namespaces from Microsoft:

Azure.Identity in Azure SDK for .Net:

https://learn.microsoft.com/en-us/dotnet/api/azure.identity?view=azure-dotnet

and Microsoft.Identity.Client in Microsoft Authentication Library (MSAL) in Entra ID:

https://learn.microsoft.com/en-us/dotnet/api/microsoft.identity.client?view=msal-dotnet-latest

I have read the overviews of both of these and they seem nearly identical. Wondering what the difference of these are and the use cases of each?

Thanks,

Karl Gardner

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Developer technologies | .NET | Other
{count} vote

Accepted answer
  1. Navya 20,100 Reputation points Microsoft External Staff Moderator
    2024-07-15T15:03:03.1433333+00:00

    Hi @Karl Gardner

    Thank you for posting this in Microsoft Q&A.

    MSAL and azure-identity support the same authentication flows, but azure-identity has simpler API because it's designed to integrate with Azure SDK clients and hide the complexity of authentication from applications.

    Azure.Identity is a namespace that provides a unified authentication model for all Azure SDKs. The Azure.Identity namespace supports a variety of authentication scenarios, including managed identities, service principals, and user principals. The credential classes exposed by azure.identity are designed to provide a straightforward way to authenticate Azure SDK clients locally, in development environments, and in production.

    Microsoft.Identity.Client namespace that provides authentication functionality for Microsoft identity platforms. It enables developers to acquire security tokens from the Microsoft identity platform to authenticate users and access secured web APIs. It can be used to provide secure access to Microsoft Graph, other Microsoft APIs, third-party web APIs, or your own web API.For more information about: https://learn.microsoft.com/en-us/entra/identity-platform/msal-overview

    Custom APIs refer to APIs that are built by developers to connect to custom resources or services that are not part of the Azure platform. For example, if you have a custom web API that you want to secure with Microsoft identity, you can use Microsoft.Identity.Client to acquire security tokens and authenticate users.

    Hope this helps. Do let us know if you any further queries.

    Thanks,

    Navya.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    2 people found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Abiola Akinbade 29,490 Reputation points Volunteer Moderator
    2024-07-14T22:12:31.0966667+00:00

    Yes they are different.

    Azure.Identity is Specialized for Azure services authentication. It simplifies getting tokens azure resources with a focus on managed identities and service principals.

    While MSAL is for various Microsoft services and custom APIs and provides user auth flows, token acquisition and various app support. It is suitable for user flows where you need to sign in a user and access resources.

    See: https://learn.microsoft.com/en-us/dotnet/api/azure.identity?view=azure-dotnet

    https://learn.microsoft.com/en-us/dotnet/api/microsoft.identity.client?view=msal-dotnet-latest

    Please remember to 'Accept Answer' and 'Upvote' if you found the above information useful.

    Regards,

    Abiola


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.