agentleFS
timothywarner-orgtimothywarner-org/prompt-pro/.claude/skills/bicep-deployment/SKILL.md

bicep-deployment

Skill48 starsChanged 6 months agoMITView on GitHub

Author, validate, preview, and ship Azure infrastructure with Bicep the safe way - what-if before deploy, the four deployment scopes, idempotent re-runs, and Well-Architected guardrails. Use when designing or reviewing Bicep templates, choosing a deployment scope, wiring Bicep into GitHub Actions, or teaching IaC deployment workflow. Pairs with the azure-principal-architect agent for design-then-deploy handoffs.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never run a bare az deployment ...

    line 14
  2. Distinctive:

    Deploy: only after a human (or a gate) reads the what-if output.

    line 19
  3. Very specific:

    Use existing references: instead of redeploying resources you only need to read.

    line 72

≈ “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

Bicep deployment

Bicep is Azure's domain-specific language for declarative infrastructure. You describe the desired state of resources, and the Azure Resource Manager (ARM) engine figures out the create, update, or no-op needed to reach it. This skill teaches the safe deployment loop that keeps demos green and production intact.

Teaching note: every example uses the Contoso Robotics scenario (mid-size robotics manufacturer, 500 employees, Austin TX). Swap the names, keep the pattern.

The golden rule: what-if before apply

Never run a bare az deployment ... create against an environment you care about. The loop is always:

  1. Lint the template so syntax and best-practice warnings surface early.
  2. Validate so ARM checks the template against the target scope.
  3. What-if so you see the exact create / modify / delete set before anything changes.
  4. Deploy only after a human (or a gate) reads the what-if output.
  5. Verify the resources match intent, then record outputs.

The two scripts in scripts/ encode steps 1-5 so learners run the loop, not just the last line.

When to reach for this skill

  • You are about to write or review a .bicep or .bicepparam file.
  • You need to pick the right deployment scope (tenant, management group, subscription, resource group).
  • You are wiring Bicep into GitHub Actions with OIDC and want the what-if-as-gate pattern.
  • You are teaching IaC and need a clean, idempotent, real-world demo.

Quick start (Contoso Robotics)

The templates/ folder ships a deployable starter: a storage account plus a Log Analytics workspace at resource group scope. Preview then deploy with the bundled scripts.

# 0. Lint first - free, offline, catches mistakes before any login
./scripts/Invoke-BicepLint.ps1 -Path ./templates/main.bicep

# 1. Preview every change ARM would make - mutates nothing
./scripts/Test-BicepWhatIf.ps1 `
  -TemplateFile ./templates/main.bicep `
  -ParameterFile ./templates/main.bicepparam `
  -ResourceGroup rg-contoso-robotics-dev `
  -Location eastus2

# 2. Deploy after reading the what-if output. Idempotent: safe to re-run.
./scripts/Deploy-Bicep.ps1 `
  -TemplateFile ./templates/main.bicep `
  -ParameterFile ./templates/main.bicepparam `
  -ResourceGroup rg-contoso-robotics-dev `
  -Location eastus2 `
  -WhatIfFirst

Both scripts default to PowerShell 7.x + Azure CLI. They validate prerequisites, fail with meaningful exit codes, and print structured output you can screen-share.

Choosing a deployment scope

ARM deploys at four scopes. Picking wrong is the most common beginner mistake. Full decision guide in references/deployment-scopes.md; the short version:

ScopetargetScope valueDeploy withUse for
Resource groupresourceGroup (default)az deployment group createWorkload resources (storage, app, DB, networking)
Subscriptionsubscriptionaz deployment sub createCreating resource groups, policy, RBAC at sub level
Management groupmanagementGroupaz deployment mg createOrg-wide policy, blueprints, subscription placement
Tenanttenantaz deployment tenant createTenant-wide management groups, root assignments

Authoring guardrails (the short list)

  • Parameterize environment differences, not everything. Hardcode what never changes; parameterize region, SKU, names.
  • Never hardcode secrets. Reference Azure Key Vault with the getSecret function in a .bicepparam, or pull from a pipeline secret. See references/bicep-language-cheatsheet.md.
  • Use existing references instead of redeploying resources you only need to read.
  • Name with a convention. Contoso uses <type>-<workload>-<env> (e.g. st+contosorobotics+dev). Storage names have no hyphens and a 24-char limit.
  • Emit output values for anything a downstream stage or human needs (connection hints, resource IDs).
  • Set targetScope explicitly even when it is resourceGroup. Explicit beats implicit for learners reading the file.

Well-Architected at deploy time

Deployment is where reliability and security intentions get real. Before you ship, walk references/waf-deployment-checklist.md. The high-value items:

  • Reliability: zone-redundant SKUs where offered, dependsOn only when ARM cannot infer order, idempotent re-runs.
  • Security: managed identity over keys, publicNetworkAccess: 'Disabled' plus Private Link for data services, no secrets in outputs.
  • Operational excellence: what-if-as-a-gate in CI, deployment stacks for lifecycle and deny-delete, tagging for ownership and cost.
  • Cost: right-size SKUs in params per environment, tear down ephemeral demo groups, tag costCenter.

CI/CD: what-if as a pull-request gate

In GitHub Actions, run what-if on the PR and post the diff as a comment, then deploy on merge to main. Authenticate with OIDC federated credentials (no stored secrets). The pattern and a starter workflow snippet live in references/waf-deployment-checklist.md under "Pipeline integration."

Common failure modes (and the fix)

SymptomCauseFix
InvalidTemplateDeployment on a fresh groupWrong scope (RG template at sub scope)Match targetScope to the az deployment <scope> verb
Storage name ... is not availableGlobally unique name collision or invalid charsUse uniqueString(resourceGroup().id) suffix, lowercase, no -
What-if shows everything as "Modify" on a no-op runDrift, or properties ARM normalizesInspect the diff; normalized props are benign, real drift is not
Deployment hangs on a dependencyManual dependsOn creating a cycleRemove manual dependsOn; let ARM infer from symbolic references

Reference and script index

  • references/deployment-scopes.md - the four scopes, decision tree, and worked CLI examples.
  • references/bicep-language-cheatsheet.md - params, variables, loops, conditions, modules, Key Vault, functions.
  • references/waf-deployment-checklist.md - pre-deploy checklist mapped to the five WAF pillars, plus the CI/CD gate pattern.
  • scripts/Invoke-BicepLint.ps1 - offline lint of one file or a whole folder, with an optional fail-on-warning CI gate. The cheapest, fastest check in the loop.
  • scripts/Test-BicepWhatIf.ps1 - lint + validate + what-if preview. Mutates nothing.
  • scripts/Deploy-Bicep.ps1 - idempotent deploy with optional what-if confirmation gate and output capture.
  • templates/main.bicep + templates/main.bicepparam - deployable Contoso Robotics starter at RG scope.

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.