Skip to content

[Resource] Fix #33921: az bicep snapshot: Preserve linked resource ID format in bicepparam snapshot to avoid nondeterministic uniqueString regeneration - #33924

Open
Aditya Pujara (a0x1ab) with Copilot wants to merge 3 commits into
devfrom
copilot/fix-az-bicep-snapshot-unique-strings
Open

[Resource] Fix #33921: az bicep snapshot: Preserve linked resource ID format in bicepparam snapshot to avoid nondeterministic uniqueString regeneration#33924
Aditya Pujara (a0x1ab) with Copilot wants to merge 3 commits into
devfrom
copilot/fix-az-bicep-snapshot-unique-strings

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Related command

az bicep snapshot

Description

Snapshots forwarded Azure CLI’s generated deployment name, causing Bicep to evaluate deployment().name and nested uniqueString() expressions differently on each run.

  • Filter the CLI-generated azurecli<timestamp><random> deployment name from snapshot invocation.
  • Continue forwarding explicitly supplied deployment names.
  • Add regression coverage for generated and similarly named explicit values.
az bicep snapshot ... → bicep snapshot ...  # no generated --deployment-name

Testing Guide

az bicep snapshot --file main.bicepparam --mode Overwrite
az bicep snapshot --file main.bicepparam --mode Validate

History Notes

[Resource] az bicep snapshot: Preserve unresolved deployment-name expressions in snapshots.


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Copilot,
Since the current milestone time is less than 7 days, this pr may not catch up with this release.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Auto-Assign Auto assign by bot ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group act-identity-squad labels Aug 18, 2026
Copilot AI linked an issue Aug 18, 2026 that may be closed by this pull request
@azure-client-tools-agent
azure-client-tools-agent Bot marked this pull request as ready for review August 18, 2026 16:24
Copilot AI lite review requested due to automatic review settings August 18, 2026 16:24

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.

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot AI requested a review from a team as a code owner August 18, 2026 16:36
Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix az bicep snapshot generating unique strings every run [Resource] Fix #33921: az bicep snapshot: Preserve linked resource ID format in bicepparam snapshot to avoid nondeterministic uniqueString regeneration Aug 18, 2026
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

PASS

Selectors: test_resource_bicep (module)
PR head ref: copilot/fix-az-bicep-snapshot-unique-strings
PR head sha: 2aa42913bac17934fe4991d648313079d056569b
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32163418268

Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13640: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_resource_bicep

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.13, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 22 items

azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_bicep_version_greater_than_or_equal_to_use_binary_from_path PASSED [  4%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_bicep_version_greater_than_or_equal_to_use_cli_managed_binary PASSED [  9%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_ensure_bicep_installation_skip_download_if_installed_version_matches_release_tag PASSED [ 13%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_ensure_bicep_installation_skip_download_if_use_binary_from_path_is_true_and_no_version_is_specified PASSED [ 18%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_get_bicep_download_url_returns_correct_urls PASSED [ 22%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_run_bicep_command_check_version PASSED [ 27%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_run_bicep_command_check_version_cache_read_write PASSED [ 31%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_run_bicep_command_raise_error_if_bicep_cli_not_found_when_use_binary_from_path_is_true PASSED [ 36%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_run_bicep_command_raise_error_if_not_installed_and_not_auto_install PASSED [ 40%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_run_bicep_command_use_bicep_cli_from_path_in_ci PASSED [ 45%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_use_bicep_cli_from_path_false_after_install PASSED [ 50%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_validate_target_scope_raise_error_if_target_scope_does_not_match_deployment_scope PASSED [ 54%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicep::test_validate_target_scope_success_if_target_scope_matches_deployment_scope PASSED [ 59%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepSnapshot::test_snapshot_bicep_file_errors_when_bicep_too_old PASSED [ 63%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepSnapshot::test_snapshot_bicep_file_ignores_generated_deployment_name PASSED [ 68%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepSnapshot::test_snapshot_bicep_file_passes_all_optional_args PASSED [ 72%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepSnapshot::test_snapshot_bicep_file_passes_minimum_args PASSED [ 77%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepSnapshot::test_snapshot_bicep_file_passes_similarly_named_deployment_name PASSED [ 81%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepRun::test_run_bicep_cli_passthrough_forwards_split_args PASSED [ 86%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepRun::test_run_bicep_cli_passthrough_preserves_quoted_args PASSED [ 90%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepRun::test_run_bicep_cli_passthrough_preserves_windows_path_backslashes PASSED [ 95%]
azure-cli/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_bicep.py::TestBicepRun::test_run_bicep_cli_passthrough_raises_when_command_empty PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================= 22 passed in 21.88s ==============================

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot 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.

All CI checks passed and the live test succeeded for this PR. No issues found.


Posted by agent-assist (autonomous bug-fix pipeline).

@azure-client-tools-agent azure-client-tools-agent Bot added the azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent label Aug 18, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-identity-squad.

@yonzhan

Copy link
Copy Markdown
Collaborator

Resource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-identity-squad ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az bicep snapshot generates unique strings every run

4 participants