-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Migration guide for Az.Resources breaking changes #29227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Celinadhh
wants to merge
4
commits into
Azure:main
Choose a base branch
from
Celinadhh:zhaocelina/migrationGUide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cfa5060
Policy.Autorest commands with 2025-03-01 api-version (#29116)
Celinadhh c7cf92b
Revert "Policy.Autorest commands with 2025-03-01 api-version (#29116)"
80e0ee4
migration guide
7a11817
Fix variable name from 'policyDefinitionId' to 'policyAssignmentId'
Celinadhh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
255 changes: 255 additions & 0 deletions
255
documentation/migration-guides/Az.16.0.0-migration-guide.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,255 @@ | ||
| # Migration Guide for Az 16.0.0 | ||
|
|
||
| ## Az.Resources | ||
|
|
||
| ### `Get-AzPolicyAssignment` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyAssignment = Get-AzPolicyAssignment -Name MyAssignment -BackwardCompatible | ||
| $description = $policyAssignment.Properties.Description | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyAssignment = Get-AzPolicyAssignment -Name MyAssignment | ||
| $description = $policyAssignment.Description | ||
| ``` | ||
|
|
||
| ### `Get-AzPolicyDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyDefinition = Get-AzPolicyDefinition -Builtin -BackwardCompatible | select -First 1 | ||
| $policyRule = $policyDefinition.Properties.PolicyRule | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyDefinition = Get-AzPolicyDefinition -Builtin | select -First 1 | ||
| $policyRule = $policyDefinition.PolicyRule | ||
| ``` | ||
|
|
||
| ### `Get-AzPolicyExemption` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyExemption = Get-AzPolicyExemption -Scope /providers/Microsoft.Management/managementGroups/myManagementGroup -Name MyExemption -BackwardCompatible | ||
| $expiresOn = $policyExemption.Properties.ExpiresOn | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyExemption = Get-AzPolicyExemption -Scope /providers/Microsoft.Management/managementGroups/myManagementGroup -Name MyExemption | ||
| $expiresOn = $policyExemption.ExpiresOn | ||
| ``` | ||
|
|
||
| ### `Get-AzPolicySetDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policySetDefinition = Get-AzPolicySetDefinition -Builtin -BackwardCompatible | select -First 1 | ||
| $policySetParameters = $policySetDefinition.Properties.Parameters | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policySetDefinition = Get-AzPolicySetDefinition -Builtin | select -First 1 | ||
| $policySetParameters = $policySetDefinition.Parameter | ||
| ``` | ||
|
|
||
| ### `New-AzPolicyAssignment` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyAssignment = New-AzPolicyAssignment -Name MyAssignment -PolicyDefinition MyPolicyDefinition -BackwardCompatible | ||
| $enforcementMode = $policyAssignment.Properties.EnforcementMode | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyAssignment = New-AzPolicyAssignment -Name MyAssignment -PolicyDefinition MyPolicyDefinition | ||
| $enforcementMode = $policyAssignment.EnforcementMode | ||
| ``` | ||
|
|
||
| ### `New-AzPolicyDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyRule = '{ "if": { "field": "type", "like": "Microsoft.DesktopVirtualization/*" }, "then": { "effect": "deny" } }' | ||
| $policyDefinition = New-AzPolicyDefinition -Name MyDefinition -Policy $policyRule -BackwardCompatible | ||
| $policyType = $policyDefinition.Properties.PolicyType | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyRule = '{ "if": { "field": "type", "like": "Microsoft.DesktopVirtualization/*" }, "then": { "effect": "deny" } }' | ||
| $policyDefinition = New-AzPolicyDefinition -Name MyDefinition -Policy $policyRule | ||
| $policyType = $policyDefinition.PolicyType | ||
| ``` | ||
|
|
||
| ### `New-AzPolicyExemption` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyExemption = Get-AzPolicyAssignment -Name MyAssignment | New-AzPolicyExemption -Name MyExemption -ExemptionCategory Mitigated -BackwardCompatible | ||
| $policyDefinitionId = $policyExemption.Properties.PolicyAssignmentId | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyExemption = Get-AzPolicyAssignment -Name MyAssignment | New-AzPolicyExemption -Name MyExemption -ExemptionCategory Mitigated | ||
| $policyDefinitionId = $policyExemption.PolicyAssignmentId | ||
| ``` | ||
Celinadhh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### `New-AzPolicySetDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyDefinitionReferences = ('[{ "policyDefinitionId": "' + (Get-AzPolicyDefinition -Name MyDefinition).ResourceId + '"}]') | ||
| $policySetDefinition = New-AzPolicySetDefinition -Name MySetDefinition -PolicyDefinition $policyDefinitionReferences -BackwardCompatible | ||
| $policyDefinitionReferenceId = $policySetDefinition.Properties.PolicyDefinitions[0].policyDefinitionReferenceId | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyDefinitionReferences = ('[{ "policyDefinitionId": "' + (Get-AzPolicyDefinition -Name MyDefinition).ResourceId + '"}]') | ||
| $policySetDefinition = New-AzPolicySetDefinition -Name MySetDefinition -PolicyDefinition $policyDefinitionReferences | ||
| $policyDefinitionReferenceId = $policySetDefinition.PolicyDefinition[0].policyDefinitionReferenceId | ||
| ``` | ||
|
|
||
| ### `Remove-AzPolicyAssignment` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy behavior where `Remove-` cmdlets always returned a value. This parameter has now been removed. `Remove-` cmdlets will only return a value when `-PassThru` is specified. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $result = Remove-AzPolicyAssignment -Name MyAssignment -BackwardCompatible | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $result = Remove-AzPolicyAssignment -Name MyAssignment -PassThru | ||
| ``` | ||
|
|
||
| ### `Remove-AzPolicyDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy behavior where `Remove-` cmdlets always returned a value. This parameter has now been removed. `Remove-` cmdlets will only return a value when `-PassThru` is specified. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $result = Remove-AzPolicyDefinition -Name MyDefinition -BackwardCompatible | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $result = Remove-AzPolicyDefinition -Name MyDefinition -PassThru | ||
| ``` | ||
|
|
||
| ### `Remove-AzPolicyExemption` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy behavior where `Remove-` cmdlets always returned a value. This parameter has now been removed. `Remove-` cmdlets will only return a value when `-PassThru` is specified. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $result = Remove-AzPolicyExemption -Name MyExemption -BackwardCompatible | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $result = Remove-AzPolicyExemption -Name MyExemption -PassThru | ||
| ``` | ||
|
|
||
| ### `Remove-AzPolicySetDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy behavior where `Remove-` cmdlets always returned a value. This parameter has now been removed. `Remove-` cmdlets will only return a value when `-PassThru` is specified. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $result = Remove-AzPolicySetDefinition -Name MySetDefinition -BackwardCompatible | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $result = Remove-AzPolicySetDefinition -Name MySetDefinition -PassThru | ||
| ``` | ||
|
|
||
| ### `Update-AzPolicyAssignment` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyAssignment = Update-AzPolicyAssignment -Name MyAssignment -DisplayName 'My cool assignment' -BackwardCompatible | ||
| $displayName = $policyAssignment.Properties.DisplayName | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyAssignment = Update-AzPolicyAssignment -Name MyAssignment -DisplayName 'My cool assignment' | ||
| $displayName = $policyAssignment.DisplayName | ||
| ``` | ||
|
|
||
| ### `Update-AzPolicyDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyDefinition = Update-AzPolicyDefinition -Name MyDefinition -Description 'A much better policy definition' -BackwardCompatible | ||
| $description = $policyDefinition.Properties.Description | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyDefinition = Update-AzPolicyDefinition -Name MyDefinition -Description 'A much better policy definition' | ||
| $description = $policyDefinition.Description | ||
| ``` | ||
|
|
||
| ### `Update-AzPolicyExemption` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policyExemption = Update-AzPolicyExemption -Name MyExemption -ExemptionCategory Waiver -BackwardCompatible | ||
| $exemptionCategory = $policyExemption.Properties.ExemptionCategory | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policyExemption = Update-AzPolicyExemption -Name MyExemption -ExemptionCategory Waiver | ||
| $exemptionCategory = $policyExemption.ExemptionCategory | ||
| ``` | ||
|
|
||
| ### `Update-AzPolicySetDefinition` | ||
|
|
||
| The `BackwardCompatible` parameter was previously introduced to preserve the legacy `.Properties`-based output shape. This parameter has now been removed. Cmdlets always return the modern flattened object shape, and legacy access via `.Properties.*` is no longer supported. Scripts must be updated to reference first‑class properties directly. | ||
|
|
||
| #### Before | ||
| ```powershell | ||
| $policySetDefinition = Update-AzPolicySetDefinition -Name MySetDefinition -Metadata '{ "MyThing": "A really good thing" }' -BackwardCompatible | ||
| $myThing = $policySetDefinition.Properties.Metadata.MyThing | ||
| ``` | ||
|
|
||
| #### After | ||
| ```powershell | ||
| $policySetDefinition = Update-AzPolicySetDefinition -Name MySetDefinition -Metadata '{ "MyThing": "A really good thing" }' | ||
| $myThing = $policySetDefinition.Metadata.MyThing | ||
| ``` | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.