Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Cdn/Cdn.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Cdn")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("5.0.1")]
[assembly: System.Reflection.AssemblyVersionAttribute("5.0.1")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("6.0.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("6.0.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]


Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)"
Copy link

Copilot AI Jan 12, 2026

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)"

Suggested change
throw "MigrationWebApplicationFirewallMapping parameter instance should be equal to the number of WAF policy instance in the profile. Expected: $($allPoliciesWithWAF.count), Provided: $($MigrationWebApplicationFirewallMapping.count)"
throw "The number of WAF mapping entries must match the number of WAF policies in the profile. Expected: $($allPoliciesWithWAF.count), Provided: $($MigrationWebApplicationFirewallMapping.count)"

Copilot uses AI. Check for mistakes.
}
} 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."
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses "policy/policies" which appears awkward. Consider rephrasing to be more grammatically clear, such as: "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."

Suggested change
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 uses AI. Check for mistakes.
}
}

# We should raise a complaint if the customer did not enable managed identity when they have BYOC enabled.
Expand All @@ -249,7 +258,7 @@ function Start-AzFrontDoorCdnProfilePrepareMigration {
Write-Host("The parameters have been validated successfully.")

# Step1: Deal with Waf policy
if ($PSBoundParameters.ContainsKey('MigrationWebApplicationFirewallMapping')) {
if ($PSBoundParameters.ContainsKey('MigrationWebApplicationFirewallMapping') -and ${MigrationWebApplicationFirewallMapping} -and ${MigrationWebApplicationFirewallMapping}.count -gt 0) {
Write-Host("Starting to configure WAF policy upgrades.")

$hasManagedRule = $false
Expand Down Expand Up @@ -431,6 +440,11 @@ function ValidateIdentityType {
}

function ValidateWafPolicies{
if (-not ${MigrationWebApplicationFirewallMapping} -or ${MigrationWebApplicationFirewallMapping}.count -eq 0) {
Write-Debug("No WAF policies to validate.")
return
}

if (${MigrationWebApplicationFirewallMapping}.count -gt 0) {
Comment on lines +443 to 448
Copy link

Copilot AI Jan 11, 2026

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.

Copilot uses AI. Check for mistakes.
$wafPolicies = ${MigrationWebApplicationFirewallMapping}
$theSubId = $wafPolicies[0].MigratedFromId.split("/")[2]
Expand Down
2 changes: 1 addition & 1 deletion src/Cdn/Cdn.Autorest/docs/Az.Cdn.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Module Name: Az.Cdn
Module Guid: f80fb25f-4ba6-4f9c-a494-7960b9b694a8
Module Guid: d3da04a4-5307-4ffc-9d9f-d70ddd147c24
Download Help Link: https://learn.microsoft.com/powershell/module/az.cdn
Help Version: 1.0.0.0
Locale: en-US
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@ The change need to be committed after this.

## SYNTAX

### MigrateExpanded (Default)
### CreateExpanded (Default)
```
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <String> -ClassicResourceReferenceId <String>
-ProfileName <String> [-SubscriptionId <String>] [-IdentityType <String>]
[-IdentityUserAssignedIdentity <Hashtable>]
[-MigrationWebApplicationFirewallMapping <IMigrationWebApplicationFirewallMapping[]>] [-SkuName <String>]
[-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
[-IdentityUserAssignedIdentity <Hashtable>] [-SkuName <String>] [-DefaultProfile <PSObject>] [-AsJob]
[-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### CreateExpanded
### MigrateExpanded
```
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <String> -ClassicResourceReferenceId <String>
-ProfileName <String> [-SubscriptionId <String>] [-IdentityType <String>]
[-IdentityUserAssignedIdentity <Hashtable>] [-SkuName <String>] [-DefaultProfile <PSObject>] [-AsJob]
[-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
-MigrationWebApplicationFirewallMapping <IMigrationWebApplicationFirewallMapping[]> -ProfileName <String>
[-SubscriptionId <String>] [-IdentityType <String>] [-IdentityUserAssignedIdentity <Hashtable>]
[-SkuName <String>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -217,7 +216,7 @@ Type: Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.IMigrationWebApplicationFire
Parameter Sets: MigrateExpanded
Aliases:

Required: False
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Expand Down
2 changes: 1 addition & 1 deletion src/Cdn/Cdn.Autorest/generate-info.json
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"
}
28 changes: 14 additions & 14 deletions src/Cdn/Cdn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cdn", "Cdn\Cdn.csproj", "{E
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cdn.Autorest", "Cdn.Autorest", "{C371EC25-5E4E-93C1-5161-3B7B810CF1FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Cdn", "..\..\generated\Cdn\Cdn.Autorest\Az.Cdn.csproj", "{C2F37636-A8D1-4855-A4C0-3713EEB19C60}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Az.Cdn", "..\..\generated\Cdn\Cdn.Autorest\Az.Cdn.csproj", "{E3182C78-70DF-4D36-95CC-08DC42481C2D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -117,18 +117,18 @@ Global
{E79F8C9F-CFFD-41D6-AD19-641B9B95BB3C}.Release|x64.Build.0 = Release|Any CPU
{E79F8C9F-CFFD-41D6-AD19-641B9B95BB3C}.Release|x86.ActiveCfg = Release|Any CPU
{E79F8C9F-CFFD-41D6-AD19-641B9B95BB3C}.Release|x86.Build.0 = Release|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Debug|x64.ActiveCfg = Debug|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Debug|x64.Build.0 = Debug|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Debug|x86.ActiveCfg = Debug|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Debug|x86.Build.0 = Debug|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Release|Any CPU.Build.0 = Release|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Release|x64.ActiveCfg = Release|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Release|x64.Build.0 = Release|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Release|x86.ActiveCfg = Release|Any CPU
{C2F37636-A8D1-4855-A4C0-3713EEB19C60}.Release|x86.Build.0 = Release|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Debug|x64.ActiveCfg = Debug|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Debug|x64.Build.0 = Debug|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Debug|x86.ActiveCfg = Debug|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Debug|x86.Build.0 = Debug|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Release|Any CPU.Build.0 = Release|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Release|x64.ActiveCfg = Release|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Release|x64.Build.0 = Release|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Release|x86.ActiveCfg = Release|Any CPU
{E3182C78-70DF-4D36-95CC-08DC42481C2D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -140,6 +140,6 @@ Global
{2DFD09CD-2205-40B8-ABE7-AF69A8059123} = {75AB456C-8530-402C-8785-8395E57D9F98}
{ECC581D5-5B1D-40BB-A2FA-9708C6BAB72F} = {75AB456C-8530-402C-8785-8395E57D9F98}
{A8650B93-78BE-44F5-9A90-3B76F0311A16} = {75AB456C-8530-402C-8785-8395E57D9F98}
{C2F37636-A8D1-4855-A4C0-3713EEB19C60} = {C371EC25-5E4E-93C1-5161-3B7B810CF1FB}
{E3182C78-70DF-4D36-95CC-08DC42481C2D} = {C371EC25-5E4E-93C1-5161-3B7B810CF1FB}
EndGlobalSection
EndGlobal
10 changes: 5 additions & 5 deletions src/Cdn/Cdn/Az.Cdn.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 11/11/2025
# Generated on: 2026/1/13
#

@{
Expand Down Expand Up @@ -57,10 +57,10 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '5.3.1'; })
RequiredAssemblies = 'Cdn.Autorest/bin/Az.Cdn.private.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()
TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = 'Cdn.Autorest/Az.Cdn.format.ps1xml'
Expand Down Expand Up @@ -233,7 +233,7 @@ PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','PSModule','Cdn'
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Cdn'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'
Expand All @@ -259,7 +259,7 @@ PrivateData = @{

} # End of PSData hashtable

} # End of PrivateData hashtable
} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''
Expand Down
1 change: 1 addition & 0 deletions src/Cdn/Cdn/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->

## Upcoming Release
* Fixed default parameter set issue.
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ChangeLog entry "Fixed default parameter set issue" is too vague and not user-focused. According to the coding guidelines for ChangeLog.md files, entries should be written from the user's perspective and explain what changed and how it affects their usage. Consider rephrasing to something like: "Fixed parameter set selection for 'Start-AzFrontDoorCdnProfilePrepareMigration' cmdlet to properly default to 'CreateExpanded' when 'MigrationWebApplicationFirewallMapping' is not provided."

Copilot generated this review using guidance from repository custom instructions.

## Version 6.0.0
* Added support for edge action
Expand Down
17 changes: 13 additions & 4 deletions src/Cdn/Cdn/help/Start-AzFrontDoorCdnProfilePrepareMigration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ The change need to be committed after this.

## SYNTAX

### CreateExpanded (Default)
```
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <String> [-SubscriptionId <String>]
-ClassicResourceReferenceId <String> -ProfileName <String> [-SkuName <String>]
[-MigrationWebApplicationFirewallMapping <IMigrationWebApplicationFirewallMapping[]>] [-IdentityType <String>]
-ClassicResourceReferenceId <String> -ProfileName <String> [-SkuName <String>] [-IdentityType <String>]
[-IdentityUserAssignedIdentity <Hashtable>] [-DefaultProfile <PSObject>] [-AsJob] [-NoWait]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### MigrateExpanded
```
Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName <String> [-SubscriptionId <String>]
-ClassicResourceReferenceId <String> -ProfileName <String>
-MigrationWebApplicationFirewallMapping <IMigrationWebApplicationFirewallMapping[]> [-SkuName <String>]
[-IdentityType <String>] [-IdentityUserAssignedIdentity <Hashtable>] [-DefaultProfile <PSObject>] [-AsJob]
[-NoWait] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Migrate the classic AFD instance to Azure Front Door(Standard/Premium) profile.
The change need to be committed after this.
Expand Down Expand Up @@ -205,10 +214,10 @@ Waf mapping for the migrated profile

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.IMigrationWebApplicationFirewallMapping[]
Parameter Sets: (All)
Parameter Sets: MigrateExpanded
Aliases:

Required: False
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Expand Down
Loading