Skip to content

feat: replace azure-validate AZCLI/Bicep validation steps with a shared script - #2856

Merged
Tom Meschter (tmeschter) merged 2 commits into
microsoft:mainfrom
tmeschter:tmeschter-upgraded-guide
Jul 17, 2026
Merged

feat: replace azure-validate AZCLI/Bicep validation steps with a shared script#2856
Tom Meschter (tmeschter) merged 2 commits into
microsoft:mainfrom
tmeschter:tmeschter-upgraded-guide

Conversation

@tmeschter

@tmeschter Tom Meschter (tmeschter) commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #2502.
Fixes #2503.

Replaces the inline, near-duplicate Azure CLI validation sequences in the azure-validate skill's AZCLI and Bicep recipes with a single shared, cross-platform script.

What changed

  • New shared script plugin/skills/azure-validate/references/recipes/scripts/validate-deployment.{sh,ps1} (bash + PowerShell). It runs the fixed validation sequence in order and reports per-step PASS/FAIL:

    1. Azure CLI installed (az version)
    2. Authenticated (az account show)
    3. Bicep compilation (az bicep build)
    4. Template validation (az deployment {sub|group} validate)
    5. What-if preview (az deployment {sub|group} what-if) — with a concise Create/Modify/Delete change summary

    Flags: --scope sub|group, --location/--resource-group, --template (default ./infra/main.bicep), --parameters (default ./infra/main.parameters.json, auto-skipped if absent), --subscription. Prints an OVERALL: PASS/FAIL line and exits non-zero on any failure. Both scripts are non-interactive/fail-fast (no blocking prompts), suitable for agent invocation.

  • AZCLI recipe (recipes/azcli/README.md): inline steps 1–5 replaced with a script-reference section (markdown links, explanation, sub & group examples, result interpretation). Docker build and Azure Policy steps retained.

  • Bicep recipe (recipes/bicep/README.md): inline steps 1–4 replaced with the same shared script reference; checklist table updated. Linting and Policy steps retained.

Tests / evals

  • New eval fixture evals/azure-validate/fixture/bicep-cli/ — a standalone Bicep project (no azure.yaml) that routes azure-prepare to the Bicep/AZCLI recipe (the one referencing the shared script). Uses literal parameter values so az deployment validate works without azd env substitution. Bicep compiles cleanly (az bicep build).
  • New eval stimulus in evals/azure-validate/e2e-eval.yaml — "Runs validate-deployment Script - Standalone Bicep (az CLI)". Graders require the azure-validate skill to be invoked and the agent to actually run validate-deployment.(sh|ps1); they disallow azure-deploy, azd up|deploy, and az deployment ... create.

Validation performed

  • Both scripts run live end-to-end against a real subscription — all 5 steps PASS; argument-validation smoke tests pass (fail-fast, exit 2 on bad/missing args).
  • npm run build ✅ (scripts copied to output), npm run references ✅ (links stay within the skill), frontmatter ✅ on built output, token check shows no new failures.
  • npm run vally validate-stimulus ✅ (tags + earlyTerminate JSON valid).

Note on the new eval: its grader requires the agent to invoke the script rather than raw az commands, which is probabilistic. If it proves flaky in nightly runs, broaden the required regex to also accept the raw az deployment ... validate sequence, or adjust runs/threshold.

…ed script

Fixes microsoft#2503.

Adds validate-deployment.{sh,ps1} (bash + PowerShell) that runs the fixed
az validation sequence (CLI present, authenticated, bicep build, deployment
validate, what-if) with per-step PASS/FAIL, a what-if change summary, and a
non-zero exit on failure. Both the AZCLI and Bicep recipes now reference this
single shared helper instead of duplicating the inline command steps.

Adds a standalone-Bicep eval fixture and stimulus so coverage actually exercises
the script.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a000b508-d45c-4d9e-85f9-394275303cac

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the azure-validate skill’s AZCLI + Bicep validation guidance by moving the repeated Azure CLI validation sequence into a shared, cross-platform helper script (bash + PowerShell), and updates eval coverage to ensure agents actually run the helper in a standalone Bicep (no azure.yaml) scenario.

Changes:

  • Added shared validation helpers: validate-deployment.sh and validate-deployment.ps1 implementing the ordered CLI/auth/build/validate/what-if checks with PASS/FAIL + OVERALL result.
  • Updated AZCLI and Bicep recipe docs to reference the shared helper instead of inline command sequences.
  • Added a new standalone Bicep eval fixture and an E2E stimulus/grader requiring invocation of the new helper script.
Show a summary per file
File Description
plugin/skills/azure-validate/references/recipes/scripts/validate-deployment.sh New bash helper for deterministic validation sequence + summary output.
plugin/skills/azure-validate/references/recipes/scripts/validate-deployment.ps1 New PowerShell helper mirroring the bash helper behavior.
plugin/skills/azure-validate/references/recipes/bicep/README.md Replaces inline validation steps with helper-script guidance and updates checklists.
plugin/skills/azure-validate/references/recipes/azcli/README.md Replaces inline validation steps with helper-script guidance; keeps Docker/Policy steps.
evals/azure-validate/fixture/bicep-cli/infra/resources.bicep New standalone Bicep fixture module used by the added E2E stimulus.
evals/azure-validate/fixture/bicep-cli/infra/main.parameters.json New parameters file for standalone fixture (literal values, no azd substitution).
evals/azure-validate/fixture/bicep-cli/infra/main.bicep New subscription-scope standalone Bicep entrypoint for the fixture.
evals/azure-validate/fixture/bicep-cli/index.html New minimal app content for the standalone fixture.
evals/azure-validate/e2e-eval.yaml Adds new E2E stimulus + graders requiring the validate-deployment script to be run.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 6
  • Review effort level: Low

Comment thread plugin/skills/azure-validate/references/recipes/scripts/validate-deployment.sh Outdated
Comment thread plugin/skills/azure-validate/references/recipes/bicep/README.md Outdated
Comment thread plugin/skills/azure-validate/references/recipes/bicep/README.md Outdated

@RickWinter Rick Winter (RickWinter) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR replaces duplicated Bicep and Azure CLI validation guidance with shared Bash and PowerShell helpers and adds an eval fixture. I found no additional findings beyond the existing inline discussion. Nothing additional blocks merge from this pass.

- sh: guard value-consuming options against missing values (exit 2)
- sh: exclude shebang from --help output
- sh: document exit code 2 in header comment
- sh: use 'az account show --query name -o tsv' + exit code instead of grep/sed JSON parsing
- ps1: remove redundant \ summary table; keep \ to drive exit code, set inline per step
- ps1: document exit code 2; align auth check to --query/\0
- bicep README: include CLI presence in core-validation wording (checklist item + table row)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a000b508-d45c-4d9e-85f9-394275303cac
Comment thread evals/azure-validate/e2e-eval.yaml
@tmeschter
Tom Meschter (tmeschter) merged commit 3e1ce5d into microsoft:main Jul 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace azure-validate skill AZCLI validation sequence with a script Replace azure-validate skill Bicep validation sequence with a script

4 participants