azure-governance-discovery

Discovers effective Azure Policy assignments and emits schema-compliant governance-constraints JSON.

Updated May 12, 2026
One-click install
npx skills add https://github.com/sohamda/apex-try-out-demo-repo --skill azure-governance-discovery-sohamda
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: azure-governance-discovery
Source: https://github.com/sohamda/apex-try-out-demo-repo/tree/main/.github/skills/azure-governance-discovery
Command: npx skills add https://github.com/sohamda/apex-try-out-demo-repo --skill azure-governance-discovery-sohamda

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Manually auditing Azure Policy assignments across subscriptions and management groups is slow and error-prone, and pulling raw REST responses into an AI agent's context wastes tokens. This Skill runs a deterministic Python script that inventories effective policy assignments, classifies their effects, and writes a machine-readable governance-constraints JSON envelope that downstream IaC planning and code generation agents can consume directly. ## Core Features & Use Cases - Batched Policy Discovery: Lists policy assignments (including management-group inherited), definitions, set definitions, and exemptions via parallel Azure REST calls with a cached ARM token. - Effect Classification: Classifies findings as blocker, auto-remediate, or informational, downgrades exempted Deny policies, and filters Defender for Cloud auto-assignments by default. - Schema-Compliant Output: Emits a governance-constraints-v1 JSON envelope with property paths, required tags, allowed locations, and an L0 discovery attestation envelope, plus a Markdown preview artifact. - Use Case: Before generating Bicep or Terraform for a new Azure project, run the discovery script to produce 04-governance-constraints.json so the planning agent knows which policies block deployment, which tags are mandatory, and which regions are allowed. ## Quick Start Ask the agent to run governance discovery for your project by executing the discover.py script with your project name and an output path under agent-output.

Frequently Asked Questions about azure-governance-discovery

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I discover effective Azure Policy assignments for a subscription?▼

Run the discover.py script with --project and --out arguments. It performs batched REST list calls for policy assignments, definitions, set definitions, and exemptions at subscription scope, including management-group inherited assignments, and writes a JSON envelope.

How are Azure Policy effects classified for deployment planning?▼

Deny effects are classified as blockers, DeployIfNotExists and Modify as auto-remediate, and everything else as informational. Audit and Disabled effects are counted in the discovery summary but not expanded into findings.

Does the discovery include Defender for Cloud auto-assignments?▼

No, Defender auto-assignments identified by metadata.assignedBy of Security Center are filtered by default because they create noise that masks real constraints. Pass the --include-defender-auto flag to retain them.

What permissions and tools are required to run Azure Policy discovery?▼

You need Python 3.14, the Azure CLI on PATH with an authenticated session, and read access to the target subscription. The script obtains an ARM token via az account get-access-token and caches it for the run.

Why does discovery return PARTIAL status?▼

Exit code 1 with PARTIAL status means some data was written but the end-of-discovery self-check detected drift, such as the re-fetched policyAssignments page count not matching the original. Re-run with --refresh to get a complete snapshot.

Can I test the discovery script without an Azure account?▼

Yes, run pytest against scripts/test_discover.py. Fixtures in scripts/fixtures simulate az rest responses through monkeypatching, so no Azure credentials or live subscription are required.