fix: Resolve FlagMustBeSetToRestore telemetry error#932
fix: Resolve FlagMustBeSetToRestore telemetry error#932NirajC-Microsoft wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates infra/main.bicep resource-name generation to introduce per-deployment uniqueness (via a deployment timestamp) to avoid name collisions across repeated deployments.
Changes:
- Added a new
deploymentTimeparameter (defaulting toutcNow()). - Updated
solutionUniqueTextto includedeploymentTimein itsuniqueString(...)seed, affecting derived resource names.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @description('Optional. Deployment timestamp used to generate unique resource names per deployment.') | ||
| param deploymentTime string = utcNow() | ||
|
|
||
| @maxLength(5) | ||
| @description('Optional. A unique text value for the solution. This is used to ensure resource names are unique for global resources. Defaults to a 5-character substring of the unique string generated from the subscription ID, resource group name, and solution name.') | ||
| param solutionUniqueText string = take(uniqueString(subscription().id, resourceGroup().name, solutionName), 5) | ||
| @description('Optional. A unique text value for the solution. This is used to ensure resource names are unique for global resources. Defaults to a 5-character substring of the unique string generated from the subscription ID, resource group name, solution name, and deployment time.') | ||
| param solutionUniqueText string = take(uniqueString(subscription().id, resourceGroup().name, solutionName, deploymentTime), 5) |
There was a problem hiding this comment.
deploymentTime defaults to utcNow(), which makes solutionUniqueText (and therefore solutionSuffix) change on every deployment. Because solutionSuffix is used in many resource names throughout this template, redeploying to the same resource group will attempt to create a brand-new set of resources rather than updating the existing ones, potentially causing unexpected duplication and data loss. Consider keeping the current deterministic default and making the timestamp/one-off suffix opt-in (e.g., default deploymentTime to empty and only include it in uniqueString when explicitly provided, or add a separate boolean/seed parameter to control this behavior).
| @description('Optional. A unique text value for the solution. This is used to ensure resource names are unique for global resources. Defaults to a 5-character substring of the unique string generated from the subscription ID, resource group name, solution name, and deployment time.') | ||
| param solutionUniqueText string = take(uniqueString(subscription().id, resourceGroup().name, solutionName, deploymentTime), 5) |
There was a problem hiding this comment.
PR description marks this as non-breaking, but changing the default input to solutionUniqueText will change the default names of most deployed resources (since names are derived from solutionSuffix). That is effectively a breaking change for existing environments because subsequent deployments won’t target the previously-created resources. Either update the PR description to call this out, or adjust defaults to preserve existing resource names unless the user explicitly opts into per-deployment uniqueness.
Purpose
This pull request updates the way unique resource names are generated in the
infra/main.bicepdeployment template by including a deployment timestamp. This change helps ensure that resource names are unique across different deployments, even if the other parameters are the same.Resource naming improvements:
deploymentTimeparameter (defaulting to the current UTC time) to help generate unique resource names for each deployment.solutionUniqueTextparameter to includedeploymentTimein its unique string generation, ensuring that resource names are unique for each deployment instance.Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information