Modern Flask web application for managing Azure AD Conditional Access policies via Microsoft Graph API.
Follow these steps from the repository root (the folder that contains azuredeploy.json, DEPLOY_TO_AZURE.bat, etc.).
# 1) Open a new PowerShell window
# 2) Change directory into the cloned repo (adjust the path if yours is different)
cd C:\Github\CA Policy Manager Tool# Windows - Interactive wizard
.\scripts\DEPLOY_TO_AZURE.bat
# OR Windows PowerShell
.\scripts\deploy-to-azure.ps1 -ResourceGroupName "ca-policy-rg" -WebAppName "my-ca-manager" -OpenAIName "my-openai-helper"
# macOS / Linux (from repo root)
./scripts/deploy-to-azure.sh -g ca-policy-rg -w my-ca-manager -o my-openai-helperFully automated deployment includes:
- β Creates Azure App Service + Azure OpenAI
- β Configures all app settings automatically
- β Generates secure secrets
- β Creates Azure AD App Registration
- β Deploys application code
- β Enables diagnostic logging
Time: 10-12 minutes | Cost: $0-13/month
π Complete Automation Guide
β±οΈ Time: 10-15 minutes | π° Cost: Free tier available (F1) or $13/month (B1)
β¨ Fully Automated Deployment:
- β Creates Azure App Service + OpenAI
- β Automatically deploys application code from GitHub
- β Auto-generates all secrets (SECRET_KEY, API keys)
- β Configures all environment variables
- β
Root-level
requirements.txtensures Azure installs dependencies automatically - β±οΈ Wait 5-10 minutes for build to complete after deployment
π What You Need to Do:
- Click button β Fill parameters β Deploy (5-8 min)
- Wait for build β Code deploys automatically (5-10 min)
- Create Azure AD App Registration (5 min) - OR enable DEMO_MODE for testing
- Need to redeploy custom changes later? Use the Zip Deploy workflow below so dependencies install correctly every time.
Manual redeploy (Zip Deploy) when you customize code:
# Always run from the repo root so the top-level requirements.txt is included
cd "C:\Github\CA Policy Manager Tool"
# (Optional) confirm the shim points to the app folder
Get-Content .\requirements.txt # should output: -r CA_Policy_Manager_Web/requirements.txt
# Build and deploy
Compress-Archive -Path * -DestinationPath deploy.zip -Force
az webapp deploy --name <your-app-name> --resource-group <your-rg> --src-path deploy.zip --type zip
Remove-Item deploy.zipπ Complete Deployment Guide - Follow this for step-by-step instructions
β Validate deployment: After clicking the button, run:
.\validate-deployment.ps1 -WebAppName "your-app-name" -ResourceGroup "your-rg-name"CA Policy Manager Tool/
β
βββ CA_Policy_Manager_Web/ # Main web application
β βββ app.py # Flask application
β βββ ca_policy_manager.py # Core CA policy logic
β βββ ca_policy_examples.py # Policy templates
β βββ config.py # Configuration management
β βββ requirements.txt # Python dependencies
β βββ templates/ # HTML templates
β βββ static/ # CSS/JS assets
β βββ utils/ # Helper modules (AI, report analyzer)
β βββ docs/ # App-specific documentation
β βββ data/ # User data and backups
β
βββ docs/ # π All documentation (organized)
β βββ setup/ # Setup and installation guides
β βββ security/ # Security and publishing docs
β βββ archive/ # Archived/outdated docs
β
βββ setup-local.ps1 # Automated setup (Windows)
βββ setup-local.sh # Automated setup (macOS/Linux)
βββ SETUP.bat # Quick launcher (Windows)
βββ START_APP.bat # App launcher (Windows)
βββ README.md # This file
- π― Deploy from 20+ enterprise policy templates - Production-ready configurations
- π Real-time policy management - Create, read, update, and delete CA policies
- π€ AI-powered policy explanations - Understand complex policies in plain English
- π Named locations management - Configure IP-based and geographic locations
- π Bulk policy deployment - Deploy multiple policies with progress tracking
- π Dual authentication modes - Support for delegated and service principal auth
- π Modern, responsive UI - Clean interface built with Bootstrap 5
- π Policy backups - Export and import policy configurations
Supported Python versions: 3.11 and 3.12. The checker now fails fast if only Python 3.13/3.14+ is installed (those builds break several dependencies).
Windows (PowerShell)
./setup-local.ps1Linux/macOS
chmod +x setup-local.sh
./setup-local.shThe setup script now:
- β Locates a real Python 3.11/3.12 installation (shows unsupported versions it finds)
- β
Creates a fresh
.venvvirtual environment - β
Installs all 13 Python dependencies with upgraded
pip - β
Generates a secure
SECRET_KEY - β
Creates
.envwithDEMO_MODE=trueso you can load the UI without Azure creds - β
Highlights any missing
MSAL_CLIENT_IDand explains that the client secret is optional for delegated sign-in - β
Reminds you to fully stop Python (
Stop-Process -Name python -Force) when you change.env
Time: about 2β3 minutes on a broadband connection
- Open
CA_Policy_Manager_Web/.env - Replace the placeholders when you're ready to leave demo mode:
MSAL_CLIENT_ID=<your Azure app id>
# Optional unless you use client-credential auth
MSAL_CLIENT_SECRET=<client secret>
DEMO_MODE=false- Hard-restart the dev server after saving
.envβ Flask caches environment variables. On Windows useStop-Process -Name python -Force; on macOS/Linux runpkill -f "python app.py"before launching again.
Need Azure credentials? Follow docs/QUICK_SETUP.md (β5 minutes).
cd CA_Policy_Manager_Web
python app.pyOpen a browser at http://localhost:5000. If you left DEMO_MODE=true, the UI loads with sample data and the sign-in button will remind you to add real credentials.
./validate-security-fixes.ps1
# Expected: β
All 7/7 security fixes verified!- SETUP_FOR_FORKS.md - Complete setup guide for forked repos (5 min)
- QUICK_START.md - Detailed quick start with troubleshooting
- LOCAL_TESTING_GUIDE.md - Comprehensive testing guide
cd CA_Policy_Manager_Web
pip install -r requirements.txtpython app.pyOpen your browser to http://localhost:5000
# Create virtual environment (recommended)
python -m venv .venv
.venv\Scripts\Activate.ps1
# Install dependencies
cd CA_Policy_Manager_Web
pip install -r requirements.txt- Detailed Guide: See
docs/README.mdfor the full documentation index - Setup Guides: Check
CA_Policy_Manager_Web/docs/for setup and deployment - API Documentation: See
CA_Policy_Manager_Web/docs/for Graph API details
- Quick Start: See
docs/setup/QUICK_START.md - First Time Setup: See
docs/setup/START_HERE.md - All Documentation: Browse
docs/README.mdfor complete index - Contributing: See
CONTRIBUTING.md - Security: See
SECURITY.md
- Store credentials securely (never commit
.envorconfig.json) - Use separate Azure AD app registrations for read vs. write operations
- Always test policies in report-only mode first
- Maintain break-glass accounts excluded from policies
- Review audit logs regularly
MIT License - See LICENSE file for details
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This tool modifies production security policies. Always test in non-production environments first and maintain proper backups.