Skip to content

Commit f425026

Browse files
author
Landon Smith
committed
Fix enabling CDN custom domain HTTPS for Microsoft, Akamai CDN
1 parent a28b98e commit f425026

File tree

8 files changed

+5747
-8
lines changed

8 files changed

+5747
-8
lines changed

src/Cdn/Cdn.Test/ScenarioTests/CustomDomainTests.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,23 @@ public void TestCustomDomainGetRemoveWithStoppedEndpoint()
5050

5151
[Fact]
5252
[Trait(Category.AcceptanceType, Category.CheckIn)]
53-
public void TestCustomDomainHttpsWithRunningEndpoint()
53+
public void TestVerizonCustomDomainHttpsWithRunningEndpoint()
5454
{
55-
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CustomDomainEnableHttpsWithRunningEndpoint");
55+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-VerizonCustomDomainEnableHttpsWithRunningEndpoint");
56+
}
57+
58+
[Fact]
59+
[Trait(Category.AcceptanceType, Category.CheckIn)]
60+
public void TestAkamaiCustomDomainHttpsWithRunningEndpoint()
61+
{
62+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AkamaiCustomDomainEnableHttpsWithRunningEndpoint");
63+
}
64+
65+
[Fact]
66+
[Trait(Category.AcceptanceType, Category.CheckIn)]
67+
public void TestMicrosoftCustomDomainHttpsWithRunningEndpoint()
68+
{
69+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-MicrosoftCustomDomainEnableHttpsWithRunningEndpoint");
5670
}
5771
}
5872
}

src/Cdn/Cdn.Test/ScenarioTests/CustomDomainTests.ps1

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function Test-CustomDomainGetRemoveWithStoppedEndpoint
159159
.SYNOPSIS
160160
Enable Https for custom domain with running endpoint
161161
#>
162-
function Test-CustomDomainEnableHttpsWithRunningEndpoint
162+
function Test-VerizonCustomDomainEnableHttpsWithRunningEndpoint
163163
{
164164
# Hard-coding host and endpoint names due to requirement for DNS CNAME
165165
$endpointName = "testVerizonEP"
@@ -203,5 +203,85 @@ function Test-CustomDomainEnableHttpsWithRunningEndpoint
203203

204204
Assert-ThrowsContains { $customDomain | Disable-AzCdnCustomDomainHttps } "BadRequest"
205205

206+
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
207+
}
208+
209+
<#
210+
.SYNOPSIS
211+
Enable Https for custom domain with running endpoint
212+
#>
213+
function Test-AkamaiCustomDomainEnableHttpsWithRunningEndpoint
214+
{
215+
# Hard-coding host and endpoint names due to requirement for DNS CNAME
216+
$endpointName = "testAkamaiEP"
217+
$hostName = "testAkamai.dustydog.us"
218+
219+
$customDomainName = getAssetName
220+
221+
$profileName = getAssetName
222+
$resourceGroup = TestSetup-CreateResourceGroup
223+
$resourceLocation = "EastUS"
224+
$profileSku = "Standard_Akamai"
225+
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
226+
$profile = New-AzCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -Sku $profileSku -Tag $tags
227+
228+
$originName = getAssetName
229+
$originHostName = "www.microsoft.com"
230+
$endpoint = New-AzCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -OriginName $originName -OriginHostName $originHostName
231+
$validateResult = Test-AzCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
232+
Assert-True{$validateResult.CustomDomainValidated}
233+
234+
$customDomain = New-AzCdnCustomDomain -HostName $hostName -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
235+
Assert-AreEqual $customDomainName $customDomain.Name
236+
Assert-AreEqual $hostName $customDomain.HostName
237+
238+
$enabled = $customDomain | Enable-AzCdnCustomDomainHttps -PassThru
239+
Assert-True{$enabled}
240+
241+
$customDomain = Get-AzCdnCustomDomain -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
242+
Assert-AreEqual $customDomain.CustomHttpsProvisioningState "Enabling"
243+
244+
Assert-ThrowsContains { $customDomain | Enable-AzCdnCustomDomainHttps } "BadRequest"
245+
246+
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
247+
}
248+
249+
<#
250+
.SYNOPSIS
251+
Enable Https for custom domain with running endpoint
252+
#>
253+
function Test-MicrosoftCustomDomainEnableHttpsWithRunningEndpoint
254+
{
255+
# Hard-coding host and endpoint names due to requirement for DNS CNAME
256+
$endpointName = "testMicrosoftEP"
257+
$hostName = "testMicrosoft.dustydog.us"
258+
259+
$customDomainName = getAssetName
260+
261+
$profileName = getAssetName
262+
$resourceGroup = TestSetup-CreateResourceGroup
263+
$resourceLocation = "EastUS"
264+
$profileSku = "Standard_Microsoft"
265+
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
266+
$profile = New-AzCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -Sku $profileSku -Tag $tags
267+
268+
$originName = getAssetName
269+
$originHostName = "www.microsoft.com"
270+
$endpoint = New-AzCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -OriginName $originName -OriginHostName $originHostName
271+
$validateResult = Test-AzCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
272+
Assert-True{$validateResult.CustomDomainValidated}
273+
274+
$customDomain = New-AzCdnCustomDomain -HostName $hostName -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
275+
Assert-AreEqual $customDomainName $customDomain.Name
276+
Assert-AreEqual $hostName $customDomain.HostName
277+
278+
$enabled = $customDomain | Enable-AzCdnCustomDomainHttps -PassThru
279+
Assert-True{$enabled}
280+
281+
$customDomain = Get-AzCdnCustomDomain -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
282+
Assert-AreEqual $customDomain.CustomHttpsProvisioningState "Enabling"
283+
284+
Assert-ThrowsContains { $customDomain | Enable-AzCdnCustomDomainHttps } "BadRequest"
285+
206286
Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
207287
}

0 commit comments

Comments
 (0)