Skip to content

Commit fa02282

Browse files
authored
fix aks test case (#20684)
1 parent 59b1e5a commit fa02282

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU
88
$kubeClusterName = New-LiveTestResourceName
99

1010
# step 1: create a default aks cluster with default node pool
11-
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
11+
12+
ssh-keygen -t rsa -f id_rsa -q -N '"123456"'
13+
$sshKeyValue = Get-Content id_rsa.pub -Raw
14+
15+
$kvName = "LiveTestKeyVault"
16+
$aksSPIdKey = "AKSSPId"
17+
$aksSPSecretKey = "AKSSPSecret"
18+
$ServicePrincipalId = Get-AzKeyVaultSecret -VaultName $kvName -Name $aksSPIdKey -AsPlainText
19+
$ServicePrincipalSecret = Get-AzKeyVaultSecret -VaultName $kvName -Name $aksSPSecretKey -AsPlainText
20+
$servicePrincipalSecureSecret = ConvertTo-SecureString -String $ServicePrincipalSecret -AsPlainText -Force
21+
$servicePrincipalCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ServicePrincipalId, $servicePrincipalSecureSecret
22+
23+
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -SshKeyValue $sshKeyValue -ServicePrincipalIdAndSecret $servicePrincipalCredential
24+
1225
$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
1326
Assert-NotNull $cluster.Fqdn
1427
Assert-NotNull $cluster.KubernetesVersion

0 commit comments

Comments
 (0)