build/jobs/e2e-tests.yml [10:43]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - task: AzurePowerShell@4
    displayName: 'Set Variables'
    inputs:
      azureSubscription: $(ConnectedServiceName)
      azurePowerShellVersion: latestVersion
      ScriptType: inlineScript
      Inline: |
        $keyVault = "$(DeploymentEnvironmentName)-ts"
        $secrets = Get-AzKeyVaultSecret -VaultName $keyVault
        
        foreach($secret in $secrets)
        {
            $environmentVariableName = $secret.Name.Replace("--","_")

            $secretValue = Get-AzKeyVaultSecret -VaultName $keyVault -Name $secret.Name
            # Replace with -AsPlainText flag when v5.3 of the Az Module is supported
            $plainValue = ([System.Net.NetworkCredential]::new("", $secretValue.SecretValue).Password).ToString()
            if([string]::IsNullOrEmpty($plainValue))
            {
                throw "$($secret.Name) is empty"
            }
            Write-Host "##vso[task.setvariable variable=$($environmentVariableName)]$($plainValue)"
        }

        $storageAccounts = Get-AzStorageAccount -ResourceGroupName $(ResourceGroupName)
        $allStorageAccounts = ""
        foreach ($storageAccount in $storageAccounts) {
            $accKey = Get-AzStorageAccountKey -ResourceGroupName $(ResourceGroupName) -Name $storageAccount.StorageAccountName | Where-Object {$_.KeyName -eq "key1"}

            $storageSecretName = "$($storageAccount.StorageAccountName)_secret"
            Write-Host "##vso[task.setvariable variable=$($storageSecretName)]$($accKey.Value)"
            $allStorageAccounts += "$($storageSecretName)|$($accKey.Value)|"
        }
        Write-Host "##vso[task.setvariable variable=AllStorageAccounts]$($allStorageAccounts)"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



build/jobs/run-export-tests.yml [16:49]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - task: AzurePowerShell@4
    displayName: 'Set Variables'
    inputs:
      azureSubscription: $(ConnectedServiceName)
      azurePowerShellVersion: latestVersion
      ScriptType: inlineScript
      Inline: |
        $keyVault = "$(DeploymentEnvironmentName)-ts"
        $secrets = Get-AzKeyVaultSecret -VaultName $keyVault
        
        foreach($secret in $secrets)
        {
            $environmentVariableName = $secret.Name.Replace("--","_")

            $secretValue = Get-AzKeyVaultSecret -VaultName $keyVault -Name $secret.Name
            # Replace with -AsPlainText flag when v5.3 of the Az Module is supported
            $plainValue = ([System.Net.NetworkCredential]::new("", $secretValue.SecretValue).Password).ToString()
            if([string]::IsNullOrEmpty($plainValue))
            {
                throw "$($secret.Name) is empty"
            }
            Write-Host "##vso[task.setvariable variable=$($environmentVariableName)]$($plainValue)"
        }

        $storageAccounts = Get-AzStorageAccount -ResourceGroupName $(ResourceGroupName)
        $allStorageAccounts = ""
        foreach ($storageAccount in $storageAccounts) {
            $accKey = Get-AzStorageAccountKey -ResourceGroupName $(ResourceGroupName) -Name $storageAccount.StorageAccountName | Where-Object {$_.KeyName -eq "key1"}

            $storageSecretName = "$($storageAccount.StorageAccountName)_secret"
            Write-Host "##vso[task.setvariable variable=$($storageSecretName)]$($accKey.Value)"
            $allStorageAccounts += "$($storageSecretName)|$($accKey.Value)|"
        }
        Write-Host "##vso[task.setvariable variable=AllStorageAccounts]$($allStorageAccounts)"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



