Skip to content

Latest commit

 

History

History
46 lines (27 loc) · 2.8 KB

File metadata and controls

46 lines (27 loc) · 2.8 KB

Playwright 2FA Authentication with Entra ID (AAD) or MSA

This sample demonstrates how to use the Playwright C# SDK to automatically authenticate against a web application which is protected by either Entra Id (Azure Active Directory) or a Microsoft Account which has two-factor authentication.

Read the full walkthrough blog post.

Environment Variables

Add the following:

PLAYWRIGHT_AAD_ACCOUNT_USERNAME
PLAYWRIGHT_AAD_ACCOUNT_PASSWORD
PLAYWRIGHT_AAD_ACCOUNT_TOTP
PLAYWRIGHT_MSA_ACCOUNT_USERNAME
PLAYWRIGHT_MSA_ACCOUNT_PASSWORD
PLAYWRIGHT_MSA_ACCOUNT_TOTP

TOTP values should be the Secret key from the 2FA set up step.

You will need to restart Visual Studio for the settings to be picked up.

Licenses

GitHub license

This sample is available under the Apache 2.0 open source license.

For any licensing questions, please email [email protected]

Project Sponsor

This project is sponsored by endjin, a UK-based technology consultancy who are corporate sponsors of the .NET Foundation.

For more information about our products and services, or for commercial support of this project, please contact us.

We produce two free weekly newsletters; Azure Weekly for all things about the Microsoft Azure Platform, and Power BI Weekly.

Keep up with everything that's going on at endjin via our blog, follow us on Twitter, or LinkedIn.

Our other Open Source projects can be found on GitHub

Code of conduct

This project has adopted a code of conduct adapted from the Contributor Covenant to clarify expected behavior in our community. This code of conduct has been adopted by many other projects. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.