Skip to content

Latest commit

 

History

History
77 lines (50 loc) · 3.95 KB

File metadata and controls

77 lines (50 loc) · 3.95 KB

Code samples for Microsoft identity platform documentation - Python

Welcome to the Microsoft Identity Platform Python Code Samples repository!

This repository provides a comprehensive set of end-to-end samples demonstrating how to integrate Microsoft Entra ID authentication and authorization into Python applications. The samples are organized by scenario and technology, making it easy to find the right starting point for your needs.

📁 Repository Structure

The samples are grouped by application type and scenario:

Folder App description Authentication libraries
flask-web-app Multi-purpose Flask web application with Microsoft Entra sign-in, External ID, B2C support ms-identity-python[flask]
MSAL Python
django-web-app Multi-purpose Django web application with Microsoft Entra sign-in, External ID, B2C support ms-identity-python[django]
MSAL Python
console-app-device-code Console application using device code flow for user authentication MSAL Python
cli-access-protected-api CLI application accessing protected APIs using client credentials MSAL Python
protect-function-app Azure Function protected with Easy Auth and scope validation Azure Functions
daemon-console-app Daemon applications using client credentials (secret/certificate) MSAL Python
on-behalf-of-flow Multi-tier application demonstrating On-Behalf-Of (OBO) flow MSAL Python

Each folder contains one or more samples, each with its own README and instructions.


🚀 Getting Started

  1. Browse the folders above to find the app type/scenario that matches your use case.
  2. Read the sample's README.md for prerequisites, setup instructions, and code walkthroughs.
  3. Clone and run the sample following the provided steps.

All samples are built with Python 3.8+ and the latest Microsoft Authentication Library (MSAL) for Python.


📝 Configuration & Security

  • Configuration is managed via .env files and environment variables.
  • Each sample includes multiple .env.sample templates for different identity providers (Entra ID, External ID, B2C).
  • Secrets and credentials should never be committed to source control. Use environment variables or Azure Key Vault for sensitive data.

🤝 Contributing

We welcome contributions!
Please see CONTRIBUTING.md for guidelines on submitting new samples or improvements.


📢 Support & Feedback


📄 License

This project is licensed under the MIT License.


📚 Resources