Local preflight: warn users when bicep snapshot fails and checks are skipped

Open Beginner friendly
#8,171 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
azure, go
Domain
cli, devops

Research direction

Start at the local preflight path that runs bicep snapshot and inspect the existing log.Printf handling for snapshot failures. Add a debug-visible explanation that preflight checks were skipped, then verify that it appears with --debug while normal output remains unchanged.

Written by the indexing model from the issue text.

Description

area/bicep area/validation enhancement

Problem

When bicep snapshot fails (e.g., due to templates using non-null assertions ! on module outputs that cannot be speculatively evaluated), all local preflight checks are silently skipped. Users have no visibility that the AI quota check and other preflight validations did not run.

The current code logs the failure at log.Printf level which only shows with --debug, but there is no user-facing indication that checks were skipped.

Root Cause

The Bicep snapshot engine speculatively evaluates template expressions. When a template uses patterns like:

principalId: myModule.outputs.systemAssignedMIPrincipalId!

The ! (non-null assertion) fails at snapshot time because module outputs are unknown before deployment. This causes bicep snapshot to exit with:

Template snapshotting could not be completed for the following reason:
'The provided value for the template parameter ... is not valid.
A non-null value for the property 'principalId' must be provided'

This is tracked upstream as Azure/bicep#18822 (still open).

Expected Behavior

  • When bicep snapshot fails, show a debug-level log message explaining that preflight checks could not be performed for the template
  • The message should be visible when --debug is set but not clutter normal output
  • Consider including guidance about the upstream limitation

Related

Dominant language
Go
Stars
569
Forks
365
Avg merge
2d 20h
Merged PRs (30d)
132

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/azure-dev

All issues in Azure/azure-dev

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.