A powerful command-line tool for Microsoft Entra Conditional Access policy analysis, simulation, and testing.
CA-CLI helps IAM engineers and administrators validate, test, and understand Conditional Access policies through:
- Policy Analysis: List and explain policies in human-readable format
- What-If Simulation: Test sign-in scenarios against policies
- Batch Testing: Run hundreds of scenarios concurrently for regression testing
Think of it as policy QA automation for Microsoft Entra ID.
ca listView all Conditional Access policies with:
- Policy state (enabled, report-only, disabled)
- Target users and groups
- Target applications
- Conditions (platform, client, location, risk)
- Grant controls (MFA, compliant device, approved app)
- Session controls (sign-in frequency, app controls)
./ca explain "High Risk Sign In Protection"Deep-dive into a single policy with detailed conditions and controls.
./ca whatif \
--user kiruu1234@iamkiran.onmicrosoft.com \
--app office365 \
--platform windows \
--client browser \
--country US \
--ip 40.77.182.32
Simulate a sign-in scenario and see:
- Which policies apply
- Which policies don't apply (and why)
- What controls are required
- Final access decision (allowed / MFA required / blocked)
Filter to specific policy:
./ca whatif \
--user kiruu1234@iamkiran.onmicrosoft.com \
--app office365 \
--platform windows \
--client browser \
--country US \
--ip 40.77.182.32
--policy "MFA-Pilot-Users"ca batch --input scenarios.csv --csv results.csv --json results.json --workers 10Run bulk What-If evaluations for regression testing and policy validation.
Input CSV format:
scenario_id,user,app,platform,client,country,ip,policy
TC-001,alice@contoso.com,office365,windows,browser,US,40.77.182.32,
TC-002,bob@contoso.com,office365,ios,mobile,CA,52.12.10.1,MFA-Pilot
TC-003,charlie@contoso.com,salesforce,android,mobile,UK,52.212.1.44,Output includes:
- Terminal summary (total scenarios, success/fail, top policies)
- CSV report (for Excel analysis)
- JSON report (for integrations)
- Go 1.21+
- Microsoft Entra ID tenant
- App registration with permissions:
Policy.Read.All(Application)User.Read.All(User if wants to use email/UPN instead of GUID)
- Clone repository:
git clone https://github.com/ErKiran/conditional-access-cli.git
cd conditional-access-cli-
Create app registration in Azure:
- Go to Azure Portal → Entra ID → App registrations → New
- Add API permissions:
Policy.Read.All,User.Real.All - Grant admin consent
- Create client secret
-
Configure credentials:
cp cred.env credentials.envEdit credentials.env:
CLIENT_ID=your-app-registration-client-id
CLIENT_SECRET=your-client-secret
TENANT_ID=your-tenant-id- Build:
go build -o ca- Run:
./ca list# Test pilot group across platforms
ca batch --input pilot-scenarios.csv --csv pilot-results.csv --workers 5# Test break-glass account
ca whatif \
--user breakglass@contoso.com \
--app office365 \
--platform windows \
--client browser# After policy change, rerun test suite
ca batch --input regression-suite.csv --json baseline.json --workers 10
# Compare with previous baseline
diff baseline-before.json baseline.jsonKey design decisions:
- Uses official Graph What-If API (beta endpoint)
- Concurrent worker pool for batch processing
- User UPN → object ID resolution with caching
- Rate-limit friendly (configurable workers)
Test policy against representative user/app/platform combinations before enabling.
Validate pilot group behavior across scenarios.
Test VIP accounts, contractors, BYOD devices.
Rerun scenario suite after policy changes to detect unintended impacts.
Explain why a specific sign-in failed or succeeded.
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE for details.
Built with:
Built by Kiran Adhikari as part of IAM automation tooling.
Why this exists: Conditional Access testing in the Azure Portal is manual and time-consuming. This tool brings developer-style QA automation to IAM policy management.
Who is this for:
- IAM engineers validating policy changes
- Security teams doing pre-rollout testing
- Admins troubleshooting sign-in issues
- Anyone managing Conditional Access at scale



