-
Notifications
You must be signed in to change notification settings - Fork 3.5k
az bicep snapshot generates unique strings every run #33921
Copy link
Copy link
Open
Labels
Auto-AssignAuto assign by botAuto assign by botAzure Deploymentsaz deployment/bicep/stack/deployment-scripts/ts/group exportaz deployment/bicep/stack/deployment-scripts/ts/group exportService AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.act-identity-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.
Description
Activity
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAzure Deploymentsaz deployment/bicep/stack/deployment-scripts/ts/group exportaz deployment/bicep/stack/deployment-scripts/ts/group exportService AttentionThis issue is responsible by Azure service team.This issue is responsible by Azure service team.act-identity-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.
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