fix: Added a fallback mechanism in Deployment/resourcedeployment.ps1 so that if deployment is not available, resource names and properties are reconstructed using the SolutionSuffix tag#523
Open
Harsh-Microsoft wants to merge 4 commits intodevfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request introduces a robust fallback mechanism for deployment resource mapping when deployment outputs are unavailable. The changes ensure that deployments can still be mapped even if deployment history is lost or incomplete by using resource group tags to reconstruct resource names and properties.
Key Changes:
- Enhanced the
MapResultAzmethod inDeployment/resourcedeployment.ps1with a two-tier approach: first attempting to retrieve values from deployment outputs, then falling back to reconstructing resource names using theSolutionSuffixtag - Added the
SolutionSuffixtag to resource group tags in both Bicep and ARM templates to enable the fallback mechanism - Updated ARM template API versions from
2022-09-01to2025-04-01for multipleMicrosoft.Resources/deploymentsresources
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Deployment/resourcedeployment.ps1 | Implemented comprehensive fallback mechanism in MapResultAz method with error handling, resource name reconstruction, and endpoint generation when deployment outputs are unavailable |
| infra/main.bicep | Added SolutionSuffix tag to resource group tags to support the PowerShell fallback mechanism |
| infra/main.json | Updated Bicep generator version, added SolutionSuffix tag, and changed API versions for deployment resources from 2022-09-01 to 2025-04-01 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Added a fallback mechanism in
Deployment/resourcedeployment.ps1so that if deployment is not available, resource names and properties are reconstructed using theSolutionSuffixtag.This pull request introduces improvements to the deployment resource mapping logic and updates the infrastructure templates for better reliability and compatibility. The most significant changes are the enhancement of the fallback mechanism in the deployment result mapping script, the addition of a new tag for resource group identification, and updates to the ARM template API versions.
Deployment script improvements:
MapResultAzmethod inDeployment/resourcedeployment.ps1to add robust error handling and a fallback mechanism: if deployment outputs are not available, the script now reconstructs resource names and endpoints using theSolutionSuffixtag, ensuring deployments can still be mapped even if outputs are missing. [1] [2]Infrastructure template updates:
SolutionSuffixtag to the resource group in bothinfra/main.bicepandinfra/main.json, enabling the fallback mechanism in the deployment script and improving resource identification. [1] [2]infra/main.json) to use a newer Bicep version and changed theapiVersionfor multipleMicrosoft.Resources/deploymentsresources from2022-09-01to2025-04-01, ensuring compatibility with the latest Azure features and APIs. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]infra/main.jsonto use the new API version in thelistOutputsWithSecureValuesfunction for Cosmos DB connection strings.Template metadata:
infra/main.jsonto reflect the new Bicep version. [1] [2] [3]Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information