Skip to content

Fix enabling CDN custom domain HTTPS for Microsoft, Akamai CDN #10366

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

Merged
merged 1 commit into from
Nov 18, 2019
Merged
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
18 changes: 16 additions & 2 deletions src/Cdn/Cdn.Test/ScenarioTests/CustomDomainTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,23 @@ public void TestCustomDomainGetRemoveWithStoppedEndpoint()

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCustomDomainHttpsWithRunningEndpoint()
public void TestVerizonCustomDomainHttpsWithRunningEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CustomDomainEnableHttpsWithRunningEndpoint");
TestController.NewInstance.RunPowerShellTest(_logger, "Test-VerizonCustomDomainEnableHttpsWithRunningEndpoint");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAkamaiCustomDomainHttpsWithRunningEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AkamaiCustomDomainEnableHttpsWithRunningEndpoint");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestMicrosoftCustomDomainHttpsWithRunningEndpoint()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-MicrosoftCustomDomainEnableHttpsWithRunningEndpoint");
}
}
}
82 changes: 81 additions & 1 deletion src/Cdn/Cdn.Test/ScenarioTests/CustomDomainTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function Test-CustomDomainGetRemoveWithStoppedEndpoint
.SYNOPSIS
Enable Https for custom domain with running endpoint
#>
function Test-CustomDomainEnableHttpsWithRunningEndpoint
function Test-VerizonCustomDomainEnableHttpsWithRunningEndpoint
{
# Hard-coding host and endpoint names due to requirement for DNS CNAME
$endpointName = "testVerizonEP"
Expand Down Expand Up @@ -203,5 +203,85 @@ function Test-CustomDomainEnableHttpsWithRunningEndpoint

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

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Enable Https for custom domain with running endpoint
#>
function Test-AkamaiCustomDomainEnableHttpsWithRunningEndpoint
{
# Hard-coding host and endpoint names due to requirement for DNS CNAME
$endpointName = "testAkamaiEP"
$hostName = "testAkamai.dustydog.us"

$customDomainName = getAssetName

$profileName = getAssetName
$resourceGroup = TestSetup-CreateResourceGroup
$resourceLocation = "EastUS"
$profileSku = "Standard_Akamai"
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
$profile = New-AzCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -Sku $profileSku -Tag $tags

$originName = getAssetName
$originHostName = "www.microsoft.com"
$endpoint = New-AzCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -OriginName $originName -OriginHostName $originHostName
$validateResult = Test-AzCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
Assert-True{$validateResult.CustomDomainValidated}

$customDomain = New-AzCdnCustomDomain -HostName $hostName -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
Assert-AreEqual $customDomainName $customDomain.Name
Assert-AreEqual $hostName $customDomain.HostName

$enabled = $customDomain | Enable-AzCdnCustomDomainHttps -PassThru
Assert-True{$enabled}

$customDomain = Get-AzCdnCustomDomain -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
Assert-AreEqual $customDomain.CustomHttpsProvisioningState "Enabling"

Assert-ThrowsContains { $customDomain | Enable-AzCdnCustomDomainHttps } "BadRequest"

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}

<#
.SYNOPSIS
Enable Https for custom domain with running endpoint
#>
function Test-MicrosoftCustomDomainEnableHttpsWithRunningEndpoint
{
# Hard-coding host and endpoint names due to requirement for DNS CNAME
$endpointName = "testMicrosoftEP"
$hostName = "testMicrosoft.dustydog.us"

$customDomainName = getAssetName

$profileName = getAssetName
$resourceGroup = TestSetup-CreateResourceGroup
$resourceLocation = "EastUS"
$profileSku = "Standard_Microsoft"
$tags = @{"tag1" = "value1"; "tag2" = "value2"}
$profile = New-AzCdnProfile -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -Sku $profileSku -Tag $tags

$originName = getAssetName
$originHostName = "www.microsoft.com"
$endpoint = New-AzCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -OriginName $originName -OriginHostName $originHostName
$validateResult = Test-AzCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
Assert-True{$validateResult.CustomDomainValidated}

$customDomain = New-AzCdnCustomDomain -HostName $hostName -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
Assert-AreEqual $customDomainName $customDomain.Name
Assert-AreEqual $hostName $customDomain.HostName

$enabled = $customDomain | Enable-AzCdnCustomDomainHttps -PassThru
Assert-True{$enabled}

$customDomain = Get-AzCdnCustomDomain -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
Assert-AreEqual $customDomain.CustomHttpsProvisioningState "Enabling"

Assert-ThrowsContains { $customDomain | Enable-AzCdnCustomDomainHttps } "BadRequest"

Remove-AzureRmResourceGroup -Name $resourceGroup.ResourceGroupName -Force
}
Loading