Skip to content

fix: Resolve FlagMustBeSetToRestore telemetry error#932

Closed
NirajC-Microsoft wants to merge 1 commit into
dev-v4from
codefix-telemetry-error
Closed

fix: Resolve FlagMustBeSetToRestore telemetry error#932
NirajC-Microsoft wants to merge 1 commit into
dev-v4from
codefix-telemetry-error

Conversation

@NirajC-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request updates the way unique resource names are generated in the infra/main.bicep deployment 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:

  • Added a new deploymentTime parameter (defaulting to the current UTC time) to help generate unique resource names for each deployment.
  • Updated the solutionUniqueText parameter to include deploymentTime in its unique string generation, ensuring that resource names are unique for each deployment instance.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

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.

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 deploymentTime parameter (defaulting to utcNow()).
  • Updated solutionUniqueText to include deploymentTime in its uniqueString(...) seed, affecting derived resource names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread infra/main.bicep
Comment on lines +15 to +20
@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)

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment thread infra/main.bicep
Comment on lines +19 to +20
@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)

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants