@@ -15,15 +15,106 @@ if(($null -eq $TestName) -or ($TestName -contains 'Get-AzFrontDoorCdnCustomDomai
15
15
}
16
16
17
17
Describe ' Get-AzFrontDoorCdnCustomDomain' {
18
- It ' List' - skip {
19
- { throw [System.NotImplementedException ] } | Should -Not - Throw
18
+ It ' List' {
19
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
20
+ try
21
+ {
22
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
23
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
24
+
25
+ $frontDoorCdnProfileName = ' fdp-' + (RandomString - allChars $false - len 6 );
26
+ Write-Host - ForegroundColor Green " Use frontDoorCdnProfileName : $ ( $frontDoorCdnProfileName ) "
27
+
28
+ $profileSku = " Standard_AzureFrontDoor" ;
29
+ New-AzFrontDoorCdnProfile - SkuName $profileSku - Name $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
30
+
31
+ $secretName = " se-" + (RandomString - allChars $false - len 6 );
32
+ Write-Host - ForegroundColor Green " Use secretName : $ ( $secretName ) "
33
+
34
+ $parameter = New-AzCdnCustomerCertificateParametersObject - UseLatestVersion $true - SubjectAlternativeName @ () - Type " CustomerCertificate" `
35
+ - SecretSourceId " /subscriptions/4d894474-aa7f-4611-b830-344860c3eb9c/resourceGroups/powershelltest/providers/Microsoft.KeyVault/vaults/cdn-ps-kv/certificates/cdndevcn2022-0329"
36
+
37
+ $secret = New-AzFrontDoorCdnSecret - Name $secretName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Parameter $parameter
38
+
39
+ $customDomainName = " domain-" + (RandomString - allChars $false - len 6 );
40
+ New-AzFrontDoorCdnCustomDomain - CustomDomainName $customDomainName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
41
+ - HostName " csharpsdk.dev.cdn.azure.cn" - TlSettingCertificateType " CustomerCertificate" - TlSettingMinimumTlsVersion " TLS12" `
42
+ - SecretId $secret.Id
43
+
44
+ $customDomains = Get-AzFrontDoorCdnCustomDomain - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName
45
+ $customDomains.Count | Should - Be 1
46
+ } Finally
47
+ {
48
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
49
+ }
20
50
}
21
51
22
- It ' Get' - skip {
23
- { throw [System.NotImplementedException ] } | Should -Not - Throw
52
+ It ' Get' {
53
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
54
+ try
55
+ {
56
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
57
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
58
+
59
+ $frontDoorCdnProfileName = ' fdp-' + (RandomString - allChars $false - len 6 );
60
+ Write-Host - ForegroundColor Green " Use frontDoorCdnProfileName : $ ( $frontDoorCdnProfileName ) "
61
+
62
+ $profileSku = " Standard_AzureFrontDoor" ;
63
+ New-AzFrontDoorCdnProfile - SkuName $profileSku - Name $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
64
+
65
+ $secretName = " se-" + (RandomString - allChars $false - len 6 );
66
+ Write-Host - ForegroundColor Green " Use secretName : $ ( $secretName ) "
67
+
68
+ $parameter = New-AzCdnCustomerCertificateParametersObject - UseLatestVersion $true - SubjectAlternativeName @ () - Type " CustomerCertificate" `
69
+ - SecretSourceId " /subscriptions/4d894474-aa7f-4611-b830-344860c3eb9c/resourceGroups/powershelltest/providers/Microsoft.KeyVault/vaults/cdn-ps-kv/certificates/cdndevcn2022-0329"
70
+
71
+ $secret = New-AzFrontDoorCdnSecret - Name $secretName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Parameter $parameter
72
+
73
+ $customDomainName = " domain-" + (RandomString - allChars $false - len 6 );
74
+ New-AzFrontDoorCdnCustomDomain - CustomDomainName $customDomainName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
75
+ - HostName " csharpsdk.dev.cdn.azure.cn" - TlSettingCertificateType " CustomerCertificate" - TlSettingMinimumTlsVersion " TLS12" `
76
+ - SecretId $secret.Id
77
+
78
+ $customDomain = Get-AzFrontDoorCdnCustomDomain - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - CustomDomainName $customDomainName
79
+ $customDomain.Name | Should - Be $customDomainName
80
+ } Finally
81
+ {
82
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
83
+ }
24
84
}
25
85
26
- It ' GetViaIdentity' - skip {
27
- { throw [System.NotImplementedException ] } | Should -Not - Throw
86
+ It ' GetViaIdentity' {
87
+ $PSDefaultParameterValues [' Disabled' ] = $true
88
+ $ResourceGroupName = ' testps-rg-' + (RandomString - allChars $false - len 6 )
89
+ try
90
+ {
91
+ Write-Host - ForegroundColor Green " Create test group $ ( $ResourceGroupName ) "
92
+ New-AzResourceGroup - Name $ResourceGroupName - Location $env.location
93
+
94
+ $frontDoorCdnProfileName = ' fdp-' + (RandomString - allChars $false - len 6 );
95
+ Write-Host - ForegroundColor Green " Use frontDoorCdnProfileName : $ ( $frontDoorCdnProfileName ) "
96
+
97
+ $profileSku = " Standard_AzureFrontDoor" ;
98
+ New-AzFrontDoorCdnProfile - SkuName $profileSku - Name $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Location Global
99
+
100
+ $secretName = " se-" + (RandomString - allChars $false - len 6 );
101
+ Write-Host - ForegroundColor Green " Use secretName : $ ( $secretName ) "
102
+
103
+ $parameter = New-AzCdnCustomerCertificateParametersObject - UseLatestVersion $true - SubjectAlternativeName @ () - Type " CustomerCertificate" `
104
+ - SecretSourceId " /subscriptions/4d894474-aa7f-4611-b830-344860c3eb9c/resourceGroups/powershelltest/providers/Microsoft.KeyVault/vaults/cdn-ps-kv/certificates/cdndevcn2022-0329"
105
+
106
+ $secret = New-AzFrontDoorCdnSecret - Name $secretName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName - Parameter $parameter
107
+
108
+ $customDomainName = " domain-" + (RandomString - allChars $false - len 6 );
109
+ New-AzFrontDoorCdnCustomDomain - CustomDomainName $customDomainName - ProfileName $frontDoorCdnProfileName - ResourceGroupName $ResourceGroupName `
110
+ - HostName " csharpsdk.dev.cdn.azure.cn" - TlSettingCertificateType " CustomerCertificate" - TlSettingMinimumTlsVersion " TLS12" `
111
+ - SecretId $secret.Id
112
+
113
+ $customDomain = Get-AzFrontDoorCdnCustomDomain - ResourceGroupName $ResourceGroupName - ProfileName $frontDoorCdnProfileName - CustomDomainName $customDomainName | Get-AzFrontDoorCdnCustomDomain
114
+ $customDomain.Name | Should - Be $customDomainName
115
+ } Finally
116
+ {
117
+ Remove-AzResourceGroup - Name $ResourceGroupName - NoWait
118
+ }
28
119
}
29
120
}
0 commit comments