This repository contains the Microsoft Authentication Library for .NET (MSAL.NET). It enables .NET applications to acquire tokens from the Microsoft identity platform for work and school accounts, personal Microsoft accounts, and Azure AD B2C.
Keep changes small, focused, backward compatible, and consistent with nearby code. Authentication, token caching, protocol, and public API changes require particular care because MSAL.NET is a widely consumed security library.
Before changing code, read and follow:
.github/copilot-instructions.md- all Markdown files under
.clinerules/ - the relevant skill under
.github/skills/when the task concerns an authentication flow or mTLS Proof-of-Possession CONTRIBUTING.mdfor contribution and design-proposal expectations, as well as build and test instructions
More specific instructions override this file.
src/client/Microsoft.Identity.Client/: core MSAL.NET librarysrc/client/Microsoft.Identity.Client.Broker/: broker integrationsrc/client/Microsoft.Identity.Client.Desktop/: desktop platform supportsrc/client/Microsoft.Identity.Client.Extensions.Msal/: token cache extensions, for public client scenariossrc/client/Microsoft.Identity.Client.KeyAttestation/: key attestation support, for mTLS POP supporttests/Microsoft.Identity.Test.Unit/: main unit test projecttests/Microsoft.Identity.Test.Integration.*: integration test projectstests/Microsoft.Identity.Test.Common/: shared test infrastructuretests/CacheCompat/: cross-library cache compatibility teststests/devapps/: development and manual test applicationstests/Microsoft.Identity.Test.Performance/: performance coveragebuild/: CI templates, run settings, and build supportdocs/: repository documentationtools/: development tools
LibsAndSamples.sln is the full solution. LibsAndSamples.sdk.slnf is the
smaller SDK-style solution filter and is usually faster for local work.
This is a standard .net project and standard dotnet tooling applies. The only complexity is that this is a multi-target SDK which explicitly targets:
- .NET Framework and .NET
- Netstandard 2.0
- mobile target frameworks
Note that the regular build ignores the mobile target frameworks. The CI builds those.
Unit tests use MSTest SDK v4 and NSubstitute. Follow nearby naming patterns and
use // Arrange, // Act, and // Assert comments. Prefer deterministic unit
tests that mock the HTTP layer. Integration tests are slow, require protected
Azure resources, and should be reserved for mainline scenarios.
- Follow
.editorconfig; do not make style-only or drive-by refactors. - Preserve existing file headers, line endings, nullability, and local patterns.
- Use async APIs consistently and retain
ConfigureAwait(false)in library code. - Validate inputs at method boundaries and throw specific exception types.
- Never log or expose tokens, secrets, credentials, claims, or PII.
See .github/instructions folder for more rules.