From 36478266c221930257a7a4888c097ba1b58b4926 Mon Sep 17 00:00:00 2001 From: Roderic Bos Date: Mon, 30 Oct 2023 17:35:50 +0100 Subject: [PATCH] When using the option --storagekey for the prepdocs script the key might (#866) contain `==` base64 padding at the end. This will fail to succesfully login because the script just removes the `=` signs during the split action. Copied the version from the app/start.ps1 which is better suited here. Co-authored-by: Pamela Fox --- scripts/loadenv.ps1 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/loadenv.ps1 b/scripts/loadenv.ps1 index 116abd741b..aa0d7fc3c6 100644 --- a/scripts/loadenv.ps1 +++ b/scripts/loadenv.ps1 @@ -1,16 +1,12 @@ Write-Host "Loading azd .env file from current environment" -$output = azd env get-values -foreach ($line in $output) { - if (!$line.Contains('=')) { - continue +foreach ($line in (& azd env get-values)) { + if ($line -match "([^=]+)=(.*)") { + $key = $matches[1] + $value = $matches[2] -replace '^"|"$' + [Environment]::SetEnvironmentVariable($key, $value) } - - $name, $value = $line.Split("=") - $value = $value -replace '^\"|\"$' - [Environment]::SetEnvironmentVariable($name, $value) } - $pythonCmd = Get-Command python -ErrorAction SilentlyContinue if (-not $pythonCmd) { # fallback to python3 if python not found