Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test resources script to print the environment values set. #14278

Merged
merged 2 commits into from
Aug 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ az deployment group create --resource-group $ResourceGroup --name $($DigitalTwin
# and we have to use that casing in order to get them from the deployment outputs.
$dtHostName = az deployment group show -g $ResourceGroup -n $($DigitalTwinName.ToLower()) --query 'properties.outputs.digitaltwinS_ADT_INSTANCE_ENDPOINT_URL.value' --output tsv

Write-Host("Set a new client secret for $appId`n")
Write-Host("`nSet a new client secret for $appId`n")
$appSecret = az ad app credential reset --id $appId --years 2 --query 'password' --output tsv

$user = $env:UserName
$fileName = "$user.config.json"
Write-Host("Writing user config file - $fileName`n")
Write-Host("`nWriting user config file - $fileName`n")

$config = @"
{
Expand All @@ -134,9 +134,12 @@ $environmentText = @"
}
"@

Write-Host "`nEnvironment variables set, this will now be encrypted. Copy these values for future reference.`n"
Write-Host "`n$environmentText`n"

$bytes = ([System.Text.Encoding]::UTF8).GetBytes($environmentText)
$protectedBytes = [Security.Cryptography.ProtectedData]::Protect($bytes, $null, [Security.Cryptography.DataProtectionScope]::CurrentUser)
Set-Content $outputFile -Value $protectedBytes -AsByteStream -Force
Write-Host "Test environment settings stored into encrypted $outputFile"
Write-Host "`nTest environment settings stored into encrypted $outputFile`n"

Write-Host "Done!"