-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fixed default parameter set for migration #29049
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -75,8 +75,7 @@ function Start-AzFrontDoorCdnProfilePrepareMigration { | |||||
| # Name of the pricing tier. | ||||||
| ${SkuName}, | ||||||
|
|
||||||
| [Parameter(ParameterSetName='MigrateExpanded')] | ||||||
| [AllowEmptyCollection()] | ||||||
| [Parameter(ParameterSetName='MigrateExpanded', Mandatory)] | ||||||
| [Microsoft.Azure.PowerShell.Cmdlets.Cdn.Category('Body')] | ||||||
| [Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.IMigrationWebApplicationFirewallMapping[]] | ||||||
| # Waf mapping for the migrated profile | ||||||
|
|
@@ -235,8 +234,18 @@ function Start-AzFrontDoorCdnProfilePrepareMigration { | |||||
| Write-Debug("WAF linked to the frontdoor: $allPoliciesWithWAF") | ||||||
| Write-Debug("Key vault name used for the frontdoor: $allPoliciesWithVault") | ||||||
|
|
||||||
| if (${MigrationWebApplicationFirewallMapping}.count -ne $allPoliciesWithWAF.count) { | ||||||
| throw "MigrationWebApplicationFirewallMapping parameter instance should be equal to the number of WAF policy instance in the profile." | ||||||
| # Validate WAF mapping based on parameter set | ||||||
| if ($PSCmdlet.ParameterSetName -eq 'MigrateExpanded') { | ||||||
| # In MigrateExpanded, MigrationWebApplicationFirewallMapping is mandatory | ||||||
| # Validate the count matches | ||||||
| if (${MigrationWebApplicationFirewallMapping}.count -ne $allPoliciesWithWAF.count) { | ||||||
| throw "MigrationWebApplicationFirewallMapping parameter instance should be equal to the number of WAF policy instance in the profile. Expected: $($allPoliciesWithWAF.count), Provided: $($MigrationWebApplicationFirewallMapping.count)" | ||||||
| } | ||||||
| } else { | ||||||
| # In CreateExpanded, if Front Door has WAF policies, user must use MigrateExpanded parameter set | ||||||
| if ($allPoliciesWithWAF.count -gt 0) { | ||||||
| throw "The Front Door has $($allPoliciesWithWAF.count) WAF policy/policies associated. Please provide the -MigrationWebApplicationFirewallMapping parameter with WAF policy mappings." | ||||||
|
||||||
| throw "The Front Door has $($allPoliciesWithWAF.count) WAF policy/policies associated. Please provide the -MigrationWebApplicationFirewallMapping parameter with WAF policy mappings." | |
| throw "The Front Door has $($allPoliciesWithWAF.count) associated WAF $(if ($allPoliciesWithWAF.count -eq 1) { 'policy' } else { 'policies' }). Please provide the -MigrationWebApplicationFirewallMapping parameter with WAF policy mappings." |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ValidateWafPolicies function has redundant logic. Lines 436-439 check if MigrationWebApplicationFirewallMapping is null or empty and return early, but then line 441 checks the same condition again. The inner if statement on line 441 will always be true when reached since we've already returned early if count is 0. Consider removing the redundant check on line 441.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| { | ||
| "generate_Id": "b87540a6-bd8f-4e14-bb97-83bb4cf9d31e" | ||
| "generate_Id": "81ba469a-66c9-4ffb-8535-6c7ada28141a" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| --> | ||
|
|
||
| ## Upcoming Release | ||
| * Fixed default parameter set issue. | ||
|
||
|
|
||
| ## Version 6.0.0 | ||
| * Added support for edge action | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message enhancement provides better clarity by showing both expected and provided counts. However, consider using consistent terminology. The message says "parameter instance" which might be unclear to users. Consider rewording to: "The number of WAF mapping entries must match the number of WAF policies in the profile. Expected: $($allPoliciesWithWAF.count), Provided: $ ($MigrationWebApplicationFirewallMapping.count)"