Skip to content

Fix: Preserve definitionVersion in Sync-ALZPolicyFromLibrary policy set output#1288

Merged
anwather merged 2 commits into
mainfrom
copilot/fix-sync-alzpolicyfromlibrary-definitionversion
May 5, 2026
Merged

Fix: Preserve definitionVersion in Sync-ALZPolicyFromLibrary policy set output#1288
anwather merged 2 commits into
mainfrom
copilot/fix-sync-alzpolicyfromlibrary-definitionversion

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Sync-ALZPolicyFromLibrary was silently dropping the definitionVersion field from policyDefinitions entries 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 like 2.3.0).

Change

  • Scripts/CloudAdoptionFramework/Sync-ALZPolicyFromLibrary.ps1 — after resolving policyDefinitionId/policyDefinitionName, conditionally append definitionVersion if present on the source entry:
if ($policyDefinition.definitionVersion) {
    $obj.Add("definitionVersion", $policyDefinition.definitionVersion)
}

Entries without definitionVersion are unaffected.

Copilot AI changed the title [WIP] Fix Sync-ALZPolicyFromLibrary to include definitionVersion Fix: Preserve definitionVersion in Sync-ALZPolicyFromLibrary policy set output Apr 30, 2026
Copilot AI requested a review from anwather April 30, 2026 10:29
@anwather
Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 30, 2026

@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

Already handled in commit 1a9f89ddefinitionVersion is conditionally appended to the policy definition object only when the property exists on the source entry:

if ($policyDefinition.definitionVersion) {
    $obj.Add("definitionVersion", $policyDefinition.definitionVersion)
}

@anwather anwather marked this pull request as ready for review May 4, 2026 00:07
@anwather anwather enabled auto-merge (squash) May 4, 2026 00:08
@anwather anwather merged commit 1f11f38 into main May 5, 2026
2 checks passed
@anwather anwather deleted the copilot/fix-sync-alzpolicyfromlibrary-definitionversion branch May 6, 2026 23:33
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.

Sync-ALZPolicyFromLibrary does not include definitionVersion

3 participants