Fix: Preserve definitionVersion in Sync-ALZPolicyFromLibrary policy set output#1288
Merged
anwather merged 2 commits intoMay 5, 2026
Merged
Conversation
…t output Agent-Logs-Url: https://github.com/Azure/enterprise-azure-policy-as-code/sessions/644ea653-4c8b-467d-8e40-0ec1be000b5b Co-authored-by: anwather <11281622+anwather@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Sync-ALZPolicyFromLibrary to include definitionVersion
Fix: Preserve definitionVersion in Sync-ALZPolicyFromLibrary policy set output
Apr 30, 2026
Collaborator
|
@copilot need to add definition Version into the outputted properties for a policy definition object inside a policy set definition. Only if the property exists |
Contributor
Author
Already handled in commit if ($policyDefinition.definitionVersion) {
$obj.Add("definitionVersion", $policyDefinition.definitionVersion)
} |
anwather
approved these changes
May 4, 2026
apybar
approved these changes
May 5, 2026
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.
Sync-ALZPolicyFromLibrarywas silently dropping thedefinitionVersionfield frompolicyDefinitionsentries when constructing the output object, causing generated policy set definition files to diverge from the source (e.g. ALZ library policies that pin specific definition versions like2.3.0).Change
Scripts/CloudAdoptionFramework/Sync-ALZPolicyFromLibrary.ps1— after resolvingpolicyDefinitionId/policyDefinitionName, conditionally appenddefinitionVersionif present on the source entry:Entries without
definitionVersionare unaffected.