@@ -15,11 +15,147 @@ if(($null -eq $TestName) -or ($TestName -contains 'Update-AzFrontDoorCdnRoute'))
1515}
1616
1717Describe ' Update-AzFrontDoorCdnRoute' {
18- It ' UpdateExpanded' - skip {
19- { throw [System.NotImplementedException ] } | Should -Not - Throw
18+ It ' UpdateExpanded' {
19+ {
20+ $PSDefaultParameterValues [' Disabled' ] = $true
21+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
22+ try
23+ {
24+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
25+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
26+
27+ $frontDoorCdnProfileName = ' fdp-' + (RandomString - allChars $false - len 6 );
28+ Write-Host - ForegroundColor Green " Use frontDoorCdnProfileName : $ ( $frontDoorCdnProfileName ) "
29+
30+ $profileSku = " Standard_AzureFrontDoor" ;
31+ New-AzFrontDoorCdnProfile - SkuName $profileSku - Name $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
32+
33+ $endpointName = ' end-' + (RandomString - allChars $false - len 6 );
34+ Write-Host - ForegroundColor Green " Use frontDoorCdnEndpointName : $ ( $endpointName ) "
35+ $endpoint = New-AzFrontDoorCdnEndpoint - EndpointName $endpointName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
36+
37+ $originGroupName = ' org' + (RandomString - allChars $false - len 6 );
38+ $originGroup = New-AzFrontDoorCdnOriginGroup - OriginGroupName $originGroupName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
39+ - LoadBalancingSettingSampleSize 5 `
40+ - LoadBalancingSettingSuccessfulSamplesRequired 4 `
41+ - LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
42+ - HealthProbeSettingProbeIntervalInSecond 1 `
43+ - HealthProbeSettingProbePath " /" `
44+ - HealthProbeSettingProbeProtocol $ ([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol ]::Https) `
45+ - HealthProbeSettingProbeRequestType $ ([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType ]::Get) `
46+
47+ Get-AzFrontDoorCdnOriginGroup - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - OriginGroupName $originGroupName
48+
49+ $hostName = " en.wikipedia.org" ;
50+ $originName = ' ori' + (RandomString - allChars $false - len 6 );
51+ New-AzFrontDoorCdnOrigin - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - OriginGroupName $originGroupName `
52+ - OriginName $originName - OriginHostHeader $hostName - HostName $hostName `
53+ - HttpPort 80 - HttpsPort 443 - Priority 1 - Weight 1000
54+
55+ $rulesetName = ' rs' + (RandomString - allChars $false - len 6 );
56+ Write-Host - ForegroundColor Green " Use rulesetName : $ ( $rulesetName ) "
57+ $ruleSet = New-AzFrontDoorCdnRuleSet - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Name $rulesetName
58+ $uriConditon = New-AzCdnDeliveryRuleRequestUriConditionObject - Name " RequestUri" - ParameterOperator " Any"
59+ $conditions = @ (
60+ $uriConditon
61+ );
62+ $overrideAction = New-AzCdnDeliveryRuleRouteConfigurationOverrideActionObject - Name " RouteConfigurationOverride" `
63+ - CacheConfigurationQueryStringCachingBehavior " IgnoreSpecifiedQueryStrings" `
64+ - CacheConfigurationQueryParameter " a=test" `
65+ - CacheConfigurationIsCompressionEnabled " Enabled" `
66+ - CacheConfigurationCacheBehavior " HonorOrigin"
67+ $actions = @ ($overrideAction );
68+
69+ $ruleName = ' r' + (RandomString - allChars $false - len 6 );
70+ Write-Host - ForegroundColor Green " Use ruleName : $ ( $ruleName ) "
71+ New-AzFrontDoorCdnRule - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - RuleSetName $rulesetName - Name $ruleName `
72+ - Action $actions - Condition $conditions
73+
74+ $ruleSetResoure = [Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.ResourceReference ]::new()
75+ $ruleSetResoure.Id = $ruleSet.Id
76+
77+ $routeName = ' route' + (RandomString - allChars $false - len 6 );
78+ New-AzFrontDoorCdnRoute - Name $routeName - EndpointName $endpointName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
79+ - OriginGroupId $originGroup.Id - RuleSet @ ($ruleSetResoure ) - PatternsToMatch " /*" - LinkToDefaultDomain " Enabled" - EnabledState " Enabled"
80+
81+ Update-AzFrontDoorCdnRoute - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - EndpointName $endpointName - Name $routeName `
82+ - EnabledState " Disabled"
83+ } Finally
84+ {
85+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
86+ }
87+ } | Should -Not - Throw
2088 }
2189
22- It ' UpdateViaIdentityExpanded' - skip {
23- { throw [System.NotImplementedException ] } | Should -Not - Throw
90+ It ' UpdateViaIdentityExpanded' {
91+ {
92+ $PSDefaultParameterValues [' Disabled' ] = $true
93+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
94+ try
95+ {
96+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
97+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
98+
99+ $frontDoorCdnProfileName = ' fdp-' + (RandomString - allChars $false - len 6 );
100+ Write-Host - ForegroundColor Green " Use frontDoorCdnProfileName : $ ( $frontDoorCdnProfileName ) "
101+
102+ $profileSku = " Standard_AzureFrontDoor" ;
103+ New-AzFrontDoorCdnProfile - SkuName $profileSku - Name $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
104+
105+ $endpointName = ' end-' + (RandomString - allChars $false - len 6 );
106+ Write-Host - ForegroundColor Green " Use frontDoorCdnEndpointName : $ ( $endpointName ) "
107+ $endpoint = New-AzFrontDoorCdnEndpoint - EndpointName $endpointName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
108+
109+ $originGroupName = ' org' + (RandomString - allChars $false - len 6 );
110+ $originGroup = New-AzFrontDoorCdnOriginGroup - OriginGroupName $originGroupName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
111+ - LoadBalancingSettingSampleSize 5 `
112+ - LoadBalancingSettingSuccessfulSamplesRequired 4 `
113+ - LoadBalancingSettingAdditionalLatencyInMillisecond 200 `
114+ - HealthProbeSettingProbeIntervalInSecond 1 `
115+ - HealthProbeSettingProbePath " /" `
116+ - HealthProbeSettingProbeProtocol $ ([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.ProbeProtocol ]::Https) `
117+ - HealthProbeSettingProbeRequestType $ ([Microsoft.Azure.PowerShell.Cmdlets.Cdn.Support.HealthProbeRequestType ]::Get) `
118+
119+ Get-AzFrontDoorCdnOriginGroup - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - OriginGroupName $originGroupName
120+
121+ $hostName = " en.wikipedia.org" ;
122+ $originName = ' ori' + (RandomString - allChars $false - len 6 );
123+ New-AzFrontDoorCdnOrigin - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - OriginGroupName $originGroupName `
124+ - OriginName $originName - OriginHostHeader $hostName - HostName $hostName `
125+ - HttpPort 80 - HttpsPort 443 - Priority 1 - Weight 1000
126+
127+ $rulesetName = ' rs' + (RandomString - allChars $false - len 6 );
128+ Write-Host - ForegroundColor Green " Use rulesetName : $ ( $rulesetName ) "
129+ $ruleSet = New-AzFrontDoorCdnRuleSet - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Name $rulesetName
130+ $uriConditon = New-AzCdnDeliveryRuleRequestUriConditionObject - Name " RequestUri" - ParameterOperator " Any"
131+ $conditions = @ (
132+ $uriConditon
133+ );
134+ $overrideAction = New-AzCdnDeliveryRuleRouteConfigurationOverrideActionObject - Name " RouteConfigurationOverride" `
135+ - CacheConfigurationQueryStringCachingBehavior " IgnoreSpecifiedQueryStrings" `
136+ - CacheConfigurationQueryParameter " a=test" `
137+ - CacheConfigurationIsCompressionEnabled " Enabled" `
138+ - CacheConfigurationCacheBehavior " HonorOrigin"
139+ $actions = @ ($overrideAction );
140+
141+ $ruleName = ' r' + (RandomString - allChars $false - len 6 );
142+ Write-Host - ForegroundColor Green " Use ruleName : $ ( $ruleName ) "
143+ New-AzFrontDoorCdnRule - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - RuleSetName $rulesetName - Name $ruleName `
144+ - Action $actions - Condition $conditions
145+
146+ $ruleSetResoure = [Microsoft.Azure.PowerShell.Cmdlets.Cdn.Models.Api20210601.ResourceReference ]::new()
147+ $ruleSetResoure.Id = $ruleSet.Id
148+
149+ $routeName = ' route' + (RandomString - allChars $false - len 6 );
150+ New-AzFrontDoorCdnRoute - Name $routeName - EndpointName $endpointName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
151+ - OriginGroupId $originGroup.Id - RuleSet @ ($ruleSetResoure ) - PatternsToMatch " /*" - LinkToDefaultDomain " Enabled" - EnabledState " Enabled"
152+
153+ Get-AzFrontDoorCdnRoute - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - EndpointName $endpointName - Name $routeName `
154+ | Update-AzFrontDoorCdnRoute - EnabledState " Disabled"
155+ } Finally
156+ {
157+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
158+ }
159+ } | Should -Not - Throw
24160 }
25161}
0 commit comments