Azure / Azure/azure-cli

az bicep snapshot generates unique strings every run

Open
#33,921 3 comments 1 reaction 2 assignees Claimed by @a0x1ab View on GitHub
act-identity-squad Auto-Assign Azure Deployments bug customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

az bicep snapshot has been introduced in 2.88.0

We have tried to migrate from "bicep snapshot" to "az bicep snapshot", but it does not work, because the function uniqueString will be run.

Below one of our examples

**bicep snapshot:**
"linkedResourceId": "[reference(resourceId('00000000-0000-0000-0000-000000000000', 'rg-snapshot-fnd-euwe-001', 'Microsoft.Resources/deployments', format('logAnalyticsWorkspace-{0}', uniqueString('logAnalyticsWorkspace', format('analyticsWorkspace-{0}', uniqueString('analyticsWorkspace', format('analyticsWorkspace-{0}', uniqueString('analyticsWorkspace', format('privatelink-{0}', uniqueString('privatelink', format('analyticsWorkspace-{0}', uniqueString('analyticsWorkspace', deployment().name))))))))))), '2025-04-01').outputs.resourceId.value]"

**az bicep snapshot:**
"linkedResourceId": "[reference('/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-snapshot-fnd-euwe-001/providers/Microsoft.Resources/deployments/logAnalyticsWorkspace-3ey2hd7rftyqo', '2025-04-01').outputs.resourceId.value]"

### Related command

az bicep snapshot

### Errors

Snapshot validation failed. Expected no changes, but found the following:

### Issue script & Debug output

az bicep snapshot `
--file $paramFile `
--subscription-id $subscriptionId `
--location 'westeurope' `
--mode $mode

### Expected behavior

snapshot overwrite and validate should always generate the same json.

### Environment Summary

azure-cli 2.89.1

core 2.89.1
telemetry 1.1.0

Extensions:
acrcssc 1.0.0b7
azure-devops 1.0.6

Dependencies:
msal 1.36.0
azure-mgmt-resource 24.0.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\frits\.azure'
Extensions directory 'C:\Users\frits\.azure\cliextensions'

Python (Windows) 3.14.6 (tags/v3.14.6:c63aec6, Jun 10 2026, 10:26:10) [MSC v.1944 64 bit (AMD64)]

### Additional context

_No response_

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.