diff --git a/src/Cdn/Cdn.Autorest/Properties/AssemblyInfo.cs b/src/Cdn/Cdn.Autorest/Properties/AssemblyInfo.cs index c189cd47bc25..dfbd67b5f7c8 100644 --- a/src/Cdn/Cdn.Autorest/Properties/AssemblyInfo.cs +++ b/src/Cdn/Cdn.Autorest/Properties/AssemblyInfo.cs @@ -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)] + + diff --git a/src/Cdn/Cdn.Autorest/custom/Start-AzFrontDoorCdnProfilePrepareMigration.ps1 b/src/Cdn/Cdn.Autorest/custom/Start-AzFrontDoorCdnProfilePrepareMigration.ps1 index 871cd818d71b..092796754757 100644 --- a/src/Cdn/Cdn.Autorest/custom/Start-AzFrontDoorCdnProfilePrepareMigration.ps1 +++ b/src/Cdn/Cdn.Autorest/custom/Start-AzFrontDoorCdnProfilePrepareMigration.ps1 @@ -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." + } } # We should raise a complaint if the customer did not enable managed identity when they have BYOC enabled. @@ -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 @@ -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) { $wafPolicies = ${MigrationWebApplicationFirewallMapping} $theSubId = $wafPolicies[0].MigratedFromId.split("/")[2] diff --git a/src/Cdn/Cdn.Autorest/docs/Az.Cdn.md b/src/Cdn/Cdn.Autorest/docs/Az.Cdn.md index 447b454a0cc9..4b08d7794f13 100644 --- a/src/Cdn/Cdn.Autorest/docs/Az.Cdn.md +++ b/src/Cdn/Cdn.Autorest/docs/Az.Cdn.md @@ -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 diff --git a/src/Cdn/Cdn.Autorest/docs/Start-AzFrontDoorCdnProfilePrepareMigration.md b/src/Cdn/Cdn.Autorest/docs/Start-AzFrontDoorCdnProfilePrepareMigration.md index 7ff547211443..6755bb0d130b 100644 --- a/src/Cdn/Cdn.Autorest/docs/Start-AzFrontDoorCdnProfilePrepareMigration.md +++ b/src/Cdn/Cdn.Autorest/docs/Start-AzFrontDoorCdnProfilePrepareMigration.md @@ -15,21 +15,20 @@ The change need to be committed after this. ## SYNTAX -### MigrateExpanded (Default) +### CreateExpanded (Default) ``` Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName -ClassicResourceReferenceId -ProfileName [-SubscriptionId ] [-IdentityType ] - [-IdentityUserAssignedIdentity ] - [-MigrationWebApplicationFirewallMapping ] [-SkuName ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] + [-IdentityUserAssignedIdentity ] [-SkuName ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-Confirm] [-WhatIf] [] ``` -### CreateExpanded +### MigrateExpanded ``` Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName -ClassicResourceReferenceId - -ProfileName [-SubscriptionId ] [-IdentityType ] - [-IdentityUserAssignedIdentity ] [-SkuName ] [-DefaultProfile ] [-AsJob] - [-NoWait] [-Confirm] [-WhatIf] [] + -MigrationWebApplicationFirewallMapping -ProfileName + [-SubscriptionId ] [-IdentityType ] [-IdentityUserAssignedIdentity ] + [-SkuName ] [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` ## DESCRIPTION @@ -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 diff --git a/src/Cdn/Cdn.Autorest/generate-info.json b/src/Cdn/Cdn.Autorest/generate-info.json index d80852713ebd..2333b86ff1a4 100644 --- a/src/Cdn/Cdn.Autorest/generate-info.json +++ b/src/Cdn/Cdn.Autorest/generate-info.json @@ -1,3 +1,3 @@ { - "generate_Id": "b87540a6-bd8f-4e14-bb97-83bb4cf9d31e" + "generate_Id": "81ba469a-66c9-4ffb-8535-6c7ada28141a" } diff --git a/src/Cdn/Cdn.sln b/src/Cdn/Cdn.sln index 8e59e4d5b134..32e61f268120 100644 --- a/src/Cdn/Cdn.sln +++ b/src/Cdn/Cdn.sln @@ -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 @@ -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 @@ -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 diff --git a/src/Cdn/Cdn/Az.Cdn.psd1 b/src/Cdn/Cdn/Az.Cdn.psd1 index da81fa50898a..046f21a00e8c 100644 --- a/src/Cdn/Cdn/Az.Cdn.psd1 +++ b/src/Cdn/Cdn/Az.Cdn.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 11/11/2025 +# Generated on: 2026/1/13 # @{ @@ -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' @@ -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' @@ -259,7 +259,7 @@ PrivateData = @{ } # End of PSData hashtable - } # End of PrivateData hashtable +} # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' diff --git a/src/Cdn/Cdn/ChangeLog.md b/src/Cdn/Cdn/ChangeLog.md index 3ec2c7535574..7c713b94ab8b 100644 --- a/src/Cdn/Cdn/ChangeLog.md +++ b/src/Cdn/Cdn/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release +* Fixed default parameter set issue. ## Version 6.0.0 * Added support for edge action diff --git a/src/Cdn/Cdn/help/Start-AzFrontDoorCdnProfilePrepareMigration.md b/src/Cdn/Cdn/help/Start-AzFrontDoorCdnProfilePrepareMigration.md index 600e8d8b85b3..1a04ffa0521f 100644 --- a/src/Cdn/Cdn/help/Start-AzFrontDoorCdnProfilePrepareMigration.md +++ b/src/Cdn/Cdn/help/Start-AzFrontDoorCdnProfilePrepareMigration.md @@ -15,14 +15,23 @@ The change need to be committed after this. ## SYNTAX +### CreateExpanded (Default) ``` Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName [-SubscriptionId ] - -ClassicResourceReferenceId -ProfileName [-SkuName ] - [-MigrationWebApplicationFirewallMapping ] [-IdentityType ] + -ClassicResourceReferenceId -ProfileName [-SkuName ] [-IdentityType ] [-IdentityUserAssignedIdentity ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] ``` +### MigrateExpanded +``` +Start-AzFrontDoorCdnProfilePrepareMigration -ResourceGroupName [-SubscriptionId ] + -ClassicResourceReferenceId -ProfileName + -MigrationWebApplicationFirewallMapping [-SkuName ] + [-IdentityType ] [-IdentityUserAssignedIdentity ] [-DefaultProfile ] [-AsJob] + [-NoWait] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION Migrate the classic AFD instance to Azure Front Door(Standard/Premium) profile. The change need to be committed after this. @@ -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