Skip to content

Commit

Permalink
fix aks test case (#20684)
Browse files Browse the repository at this point in the history
  • Loading branch information
YanaXu authored Jan 17, 2023
1 parent 59b1e5a commit fa02282
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Aks/Aks.Test/LiveTests/TestLiveScenarios.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ Invoke-LiveTestScenario -Name "Test_AKS_CURD" -Description "Test AKS Cluster CRU
$kubeClusterName = New-LiveTestResourceName

# step 1: create a default aks cluster with default node pool
New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName

ssh-keygen -t rsa -f id_rsa -q -N '"123456"'
$sshKeyValue = Get-Content id_rsa.pub -Raw

$kvName = "LiveTestKeyVault"
$aksSPIdKey = "AKSSPId"
$aksSPSecretKey = "AKSSPSecret"
$ServicePrincipalId = Get-AzKeyVaultSecret -VaultName $kvName -Name $aksSPIdKey -AsPlainText
$ServicePrincipalSecret = Get-AzKeyVaultSecret -VaultName $kvName -Name $aksSPSecretKey -AsPlainText
$servicePrincipalSecureSecret = ConvertTo-SecureString -String $ServicePrincipalSecret -AsPlainText -Force
$servicePrincipalCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ServicePrincipalId, $servicePrincipalSecureSecret

New-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName -SshKeyValue $sshKeyValue -ServicePrincipalIdAndSecret $servicePrincipalCredential

$cluster = Get-AzAksCluster -ResourceGroupName $resourceGroupName -Name $kubeClusterName
Assert-NotNull $cluster.Fqdn
Assert-NotNull $cluster.KubernetesVersion
Expand Down

0 comments on commit fa02282

Please sign in to comment.