Home › Azure (Functions / Bicep) › Azure Bicep Copilot path instructions

Azure Bicep Copilot path instructions

Copilot instructions for Azure Bicep: modules and parameter files, secure parameters, existing resources, what-if before deploy, linter rules, and naming and tagging.

GitHub CopilotAzure (Functions / Bicep)

How to use

Save this as .github/instructions/bicep.instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.github/instructions/bicep.instructions.mdDownload  
---
applyTo: "**/*.bicep,**/*.bicepparam,**/bicepconfig.json"
description: Azure Bicep infrastructure conventions
---

# Azure Bicep

## Workflow
- Validate with `az bicep build --file main.bicep` (runs the linter) and preview with `az deployment group what-if` (or `sub`/`mg` scope) before any deploy. Never run `az deployment ... create` unless asked; deployments go through CI.
- Linter rules live in `bicepconfig.json`; fix warnings rather than disabling them.

## Structure
- `main.bicep` orchestrates; reusable pieces are modules in `modules/`. Prefer Azure Verified Modules (`br/public:avm/...`) with pinned versions over hand-written equivalents.
- One `.bicepparam` file per environment (`dev.bicepparam`, `prod.bicepparam`) using `using './main.bicep'`. No environment `if` ladders inside templates.
- Pin resource API versions explicitly and update them deliberately.
- Reference resources you don't own with the `existing` keyword instead of redeclaring them.

## Parameters and outputs
- Every parameter has a type, `@description`, and constraints (`@allowed`, `@minLength`, `@maxLength`). Use user-defined types for structured objects.
- Secrets are `@secure()` parameters or Key Vault references (`getSecret()` in param files). Never output secrets, keys or connection strings.
- Derive names from a prefix/environment/location pattern with `uniqueString(resourceGroup().id)` where global uniqueness is needed; keep naming in one place.

## Security defaults
- Managed identities with role assignments (`Microsoft.Authorization/roleAssignments` scoped to the resource, `guid()` names) instead of access keys.
- Disable public network access and enable HTTPS-only/TLS 1.2+ where the resource supports it; diagnostics to Log Analytics.
- Apply required tags from a shared `tags` parameter to every resource.

## Done when
Build/lint is clean and the what-if output was reviewed for unexpected deletes or replacements; mention any resource that will be recreated.

More: all Azure (Functions / Bicep) rules · all GitHub Copilot rules

Related rules

Azure Functions AGENTS.md

AGENTS.md for Azure Functions apps: current programming models, local Core Tools runs, idempotent triggers, managed identity, configuration, and Durable Functions rules.

AGENTS.mdAzure (Functions / Bicep)

Dockerfile Copilot path instructions

Path-specific Copilot instructions for Dockerfiles and compose files: multi-stage builds, non-root, and pinned images.

GitHub CopilotDocker

GitHub Actions Copilot path instructions

Path-specific Copilot instructions for .github/workflows YAML: least privilege, pinned actions, and injection-safe steps.

GitHub CopilotGitHub Actions

Terraform Copilot instructions

Copilot instructions for Terraform 1.x / OpenTofu infrastructure: modules, state safety, variables, and plan review.

GitHub CopilotTerraform

Ansible Windsurf rules

Windsurf rules for Ansible playbooks and roles: FQCN modules, idempotency, check mode, vault secrets, and ansible-lint.

WindsurfAnsible

AWS CDK (TypeScript) CLAUDE.md

CLAUDE.md for AWS CDK v2 apps in TypeScript: constructs, least-privilege grants, snapshot tests, and safe deploys.

Claude Code (CLAUDE.md)AWS CDK

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.