Skip to content

Conversation

@Harsh-Microsoft
Copy link
Contributor

Purpose

This pull request enhances the robustness of the infrastructure deployment scripts by introducing a fallback mechanism for retrieving resource configuration values using the SolutionSuffix tag when deployment outputs are unavailable. It also adds short delays after enabling public access for certain Azure resources to ensure changes propagate correctly. The most important changes are:

Fallback Logic for Resource Configuration Retrieval:

  • Added new functions (Get-ValuesUsingSolutionSuffix in PowerShell and get_values_using_solution_suffix in Bash) to reconstruct resource names and critical values from the SolutionSuffix tag in the resource group, improving reliability when deployment outputs are missing. [1] [2]
  • Updated scripts to attempt retrieval from deployment outputs first, then fall back to the naming convention using SolutionSuffix, with user-friendly error messages and guidance if both methods fail. [1] [2]

Infrastructure Tagging:

  • Modified Bicep templates (main.bicep and main_custom.bicep) to include the SolutionSuffix tag in resource group tags, enabling the fallback mechanism. [1] [2]

Operational Reliability Improvements:

  • Added a 60-second delay after enabling public access for storage accounts and search services in both PowerShell and Bash scripts to allow time for the changes to take effect, reducing the likelihood of race conditions. [1] [2] [3] [4]

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request enhances the robustness of post-deployment scripts by adding a fallback mechanism to retrieve resource configuration when deployment outputs are unavailable, and introduces delays to allow Azure resource configuration changes to propagate.

  • Added fallback functions to reconstruct resource names from the SolutionSuffix tag when deployment outputs are missing
  • Updated Bicep templates to include the SolutionSuffix tag in resource group tags
  • Added 60-second delays after enabling public access for storage accounts and search services

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
infra/main.bicep Added SolutionSuffix tag to resource group tags for fallback mechanism
infra/main_custom.bicep Added SolutionSuffix tag to resource group tags for fallback mechanism
infra/scripts/Selecting-Team-Config-And-Data.ps1 Added Get-ValuesUsingSolutionSuffix function and fallback logic; added sleep delays after enabling public access
infra/scripts/selecting_team_config_and_data.sh Added get_values_using_solution_suffix function and fallback logic; added sleep delays after enabling public access
Comments suppressed due to low confidence (4)

infra/scripts/selecting_team_config_and_data.sh:487

  • The sleep statement is placed before checking if the command succeeded. If the az storage account update command fails, the script will still wait 60 seconds before checking the exit code and reporting the error. Move the sleep statement to after the error check (after line 487) to fail fast when the command errors.
            sleep 60
            if [[ $? -ne 0 ]]; then
                echo "Error: Failed to enable public access for storage account."
                exit 1
            fi

infra/scripts/selecting_team_config_and_data.sh:501

  • The sleep statement is placed before checking if the command succeeded. If the az search service update command fails, the script will still wait 60 seconds before checking the exit code and reporting the error. Move the sleep statement to after the error check (after line 501) to fail fast when the command errors.
            sleep 60
            if [[ $? -ne 0 ]]; then
                echo "Error: Failed to enable public access for search service."
                exit 1
            fi

infra/scripts/Selecting-Team-Config-And-Data.ps1:512

  • The sleep statement is placed before checking if the command succeeded. If the az storage account update command fails, the script will still wait 60 seconds before checking the exit code and reporting the error. Move the sleep statement to after the error check (after line 512) to fail fast when the command errors.
            Start-Sleep -Seconds 60
            if ($LASTEXITCODE -ne 0) {
                Write-Host "Error: Failed to enable public access for storage account."
                exit 1
            }

infra/scripts/Selecting-Team-Config-And-Data.ps1:527

  • The sleep statement is placed before checking if the command succeeded. If the az search service update command fails, the script will still wait 60 seconds before checking the exit code and reporting the error. Move the sleep statement to after the error check (after line 527) to fail fast when the command errors.
            Start-Sleep -Seconds 60
            if ($LASTEXITCODE -ne 0) {
                Write-Host "Error: Failed to enable public access for search service."
                exit 1
            }

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

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