microsoft / microsoft/GitHub-Copilot-for-Azure

Replace azure-enterprise-infra-planner skill Bicep validate and what-if preview with a script

Open
#2,522 1 comment 0 reactions 1 assignee Claimed by @JasonYeMSFT View on GitHub
azure-enterprise-infra-planner skills
Dominant language
Python
Stars
250
Forks
204
Avg merge
1d 12h
Merged PRs (30d)
67

Description

## Summary

Copilot has identified a portion of a skill that is a good candidate for replacement with a script.

The candidate is the **Bicep validate + what-if preview chain** in the `azure-enterprise-infra-planner` skill (`references/deployment.md`) — a fixed `az bicep build` → `az deployment … --what-if` preflight sequence run before any deployment is approved.

## Candidate description

Before deploying the generated Bicep infrastructure, the skill runs a deterministic preflight that validates the template and previews the changes:

1. `az bicep build --file infra/main.bicep` — compile/validate the template.
2. For resource-group scope: `az deployment group create … --what-if` — preview the changes.
3. For subscription scope: `az deployment sub create … --what-if` — preview the changes.

This is a strong script candidate because it is:
- **A fixed preflight sequence** whose entire purpose is to *gather* a pass/fail validation result and a change preview before a human approves the actual deploy — exactly the "output-heavy, only the pass/fail + diff matters" pattern.
- **Parameterizable** by scope / resource-group / location / template / parameters, returning a concise validation + change summary.
- **Duplicated** — the `az bicep build` validation step recurs in the pre-deployment checklist (`deployment.md` L21), in `bicep-generation.md` (L71), and abstractly in `phases/7-deploy.md` (L9).

**Sketch — `preflight-bicep.{sh,ps1}`:**
- **Input:** `--template` (default `infra/main.bicep`), `--scope` (`group`|`sub`), `--resource-group`, `--location`, `--parameters`.
- **Output:** the build/validation result (pass/fail) and a concise what-if change summary (creates/modifies/deletes), so the agent gets one digest instead of parsing raw what-if output.

> Selecting `targetScope` (resource-group vs. subscription) from `main.bicep` is a decision the agent makes and passes in as `--scope`. The actual `az deployment … create` **execute** step (without `--what-if`) is the destructive action and must stay behind explicit user confirmation in prose — only the build + what-if preflight is "run-without-judgment."

**Note — cross-skill overlap:** This Bicep validate/what-if preflight parallels the `azure-deploy` skill's deployment-verification work (#2512) and its Container Apps deployment candidate (#2518). The two skills may be able to share the same IaC-preflight script family rather than each authoring its own.

## Affected file and lines

- [`references/deployment.md` — Bicep build + what-if preview (L27–L91)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-enterprise-infra-planner/references/deployment.md#L27-L91)
- [`references/bicep-generation.md` — `az bicep build` validation (L71)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-enterprise-infra-planner/references/bicep-generation.md#L71)

## Next steps

1. **Evaluate the candidate** — confirm the steps are stable and parameterizable, and that the script captures everything the skill needs.
2. **Create both a bash _and_ a PowerShell version** of the script so the skill works across platforms.
3. **Run integration tests** to verify the scripts behave correctly and the skill still completes end-to-end.

## Background Information

### Why replace regular steps with scripts

Replacing a regular, well-defined series of steps with a script can:

- **Reduce token usage** — the skill no longer needs to spell out each command and parse large command output inline; the agent invokes one script and reads a compact result.
- **Improve reliability** — the logic is written and tested once, instead of being re-derived by the agent on every run.
- **Improve determinism** — the same inputs always produce the same steps and output, removing run-to-run variation.
- **Improve speed of execution** — a single script call replaces multiple round-trips of command generation, execution, and large-output parsing.

### Authoring notes for the scripts

- **Reference scripts with markdown links**, not just a bare path to the script file.
- **Include examples** in the skill showing how to run each script (sample invocation with arguments).
- **Briefly explain what each script does** where it is referenced.
- **The script output should explain what it did**, so the agent and user can understand the result without re-inspecting raw command output.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.