agentleFS
Microsoft AzureKnown publisherAzure/FederalAVD/.github/skills/federalavd-policy-authoring/SKILL.md

federalavd-policy-authoring

Skill18 starsChanged 3 months agoMITView on GitHub

Create, modify, review, and validate FederalAVD session-host Azure Policy definitions, initiatives, assignments, remediation templates, and policy RBAC. Use when changing Modify or DeployIfNotExists policies, nested deployment templates, policy sets, policy assignment parameters, compliance conditions, or policy deployment sequencing.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 10 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use this workflow for policy resources under deployments/shared/modules/orchestration/sessionHostPolicy/.

    line 9
  2. Distinctive:

    Start from the policy capability and trace its complete path:

    line 16
  3. Very specific:

    Use Modify for properties changed on the evaluated VM, NIC, identity, or disk request.

    line 31
  4. Very specific:

    Use DeployIfNotExists for related resources such as extensions, Run Commands, and data collection associations.

    line 32
  5. Distinctive:

    Use an initiative only when member policies share lifecycle, assignment scope, remediation identity, and sequencing.

    line 34
  6. Very specific:

    Treat policy definition and initiative files under the shared modules/ directory as direct deployment sources.

    line 41
  7. Distinctive:

    Prefer Bicep for new remediation templates.

    line 49
  8. Very specific:

    When a sibling .bicep exists, edit it and regenerate its adjacent .json.

    line 50
  9. Very specific:

    Keep any PowerShell loaded with loadTextContent() ASCII-only and run parser and ASCII checks.

    line 54
  10. Distinctive:

    Keep policy parameters aligned across every boundary:

    line 56
  11. Distinctive:

    Keep RBAC synchronized with policy behavior:

    line 70
  12. Very specific:

    Every role in a policy definition's roleDefinitionIds must have a corresponding assignment for the remediation identity.

    line 72
  13. Distinctive:

    Keep the remediation identity, artifact-download identity, and VM system-assigned identity responsibilities distinct.

    line 75
  14. Distinctive:

    Add explicit dependencies when assignment activation relies on RBAC propagation or another policy assignment.

    line 77
  15. Distinctive:

    Every new definition output is consumed by its intended initiative or assignment.

    line 109
  16. Distinctive:

    Every initiative member receives all required parameter mappings.

    line 110
  17. Very specific:

    Every roleDefinitionIds entry is matched by deployed RBAC.

    line 111
  18. Distinctive:

    Do not deploy policy resources as a separate repository-level stack.

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

FederalAVD Policy Authoring

Use this workflow for policy resources under deployments/shared/modules/orchestration/sessionHostPolicy/. Read its AUTHORING.md before changing policy structure. Consumer entry points such as deployments/automatedHostPools/policy/ adapt and sequence these canonical modules but do not own policy implementations.

Procedure

  1. Start from the policy capability and trace its complete path:

    automatedHostPool.bicep
      -> policy/main.bicep
        -> policy definition or initiative
        -> policyAssignment.bicep
        -> remediation identity and role assignments

    Trace every affected consumer to the canonical shared orchestration. Keep one definition and deterministic assignment implementation; do not copy policy resources into consumer entry points.

  2. Classify the behavior before editing:

    • Use Modify for properties changed on the evaluated VM, NIC, identity, or disk request.
    • Use DeployIfNotExists for related resources such as extensions, Run Commands, and data collection associations.
    • Use an initiative only when member policies share lifecycle, assignment scope, remediation identity, and sequencing.
  3. Obtain current Bicep best practices and authoritative Azure resource schemas for every resource type being changed. For policy fields, effects, and aliases, verify current Microsoft Azure Policy documentation rather than inferring behavior from existing generated JSON.
  4. Treat policy definition and initiative files under the shared modules/ directory as direct deployment sources. Policy definition modules must declare Microsoft.Authorization/policyDefinitions; initiative modules must declare Microsoft.Authorization/policySetDefinitions. Do not generate standalone ARM files for these modules for another Bicep file to ingest.
  5. For a DeployIfNotExists policy, maintain its nested remediation template under the shared modules/templates/ directory:

    • Prefer Bicep for new remediation templates.
    • When a sibling .bicep exists, edit it and regenerate its adjacent .json; never hand-edit that generated JSON.
    • The policy-definition Bicep module loads the generated JSON with loadJsonContent() and embeds it under details.deployment.properties.template.
    • Keep any PowerShell loaded with loadTextContent() ASCII-only and run parser and ASCII checks.
  6. Keep policy parameters aligned across every boundary:

    • Policy definition parameter declaration.
    • Policy rule references.
    • Nested deployment parameter mapping for DeployIfNotExists.
    • Initiative member parameter mapping, when applicable.
    • Assignment parameter envelope in policy/main.bicep.
    • Public automated-host-pool parameter and UI form, when user configurable.
  7. Make compliance checks measure the intended end state. Run Command policies in this repository use successful provisioning of the named Run Command as compliance. Do not use version changes to force existing hosts through a new customization unless the lifecycle contract is explicitly changed.
  8. Keep RBAC synchronized with policy behavior:

    • Every role in a policy definition's roleDefinitionIds must have a corresponding assignment for the remediation identity.
    • Grant roles at the narrowest workable scope.
    • Keep the remediation identity, artifact-download identity, and VM system-assigned identity responsibilities distinct.
    • Add explicit dependencies when assignment activation relies on RBAC propagation or another policy assignment.
  9. Preserve the dedicated session-host resource group as the policy enforcement boundary. Do not broaden assignments for policies whose resource-type predicates rely on that isolation.
  10. Build generated dependencies before their consumers. For each changed remediation Bicep file:

    az bicep build `
      --file <nested-template>.bicep `
      --outfile <nested-template>.json
  11. Compile the policy stage, regenerate the tracked automated-host-pool ARM template, and verify synchronization:

    az bicep build `
      --file deployments/automatedHostPools/policy/main.bicep `
      --stdout | Out-Null
    
    az bicep build `
      --file deployments/automatedHostPools/automatedHostPool.bicep `
      --outfile deployments/automatedHostPools/automatedHostPool.json
    
    & .github/skills/federalavd-bicep-maintenance/scripts/Test-BicepArmSync.ps1 `
      -BicepPath deployments/automatedHostPools/automatedHostPool.bicep
  12. Before finishing, verify:

    • Every new definition output is consumed by its intended initiative or assignment.
    • Every initiative member receives all required parameter mappings.
    • Every roleDefinitionIds entry is matched by deployed RBAC.
    • Conditional definitions, initiatives, assignments, and RBAC use the same feature condition.
    • Generated JSON changes are expected and git diff --check passes.
    • The shared AUTHORING.md and affected consumer documentation remain accurate.

Do not deploy policy resources as a separate repository-level stack. They are an internal stage of the automated host-pool dependency graph.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.