Skip to content

Commit

Permalink
Update test resources script to print the environment values set. (#1…
Browse files Browse the repository at this point in the history
…4278)

* resources(digitaltwins): Update test resources script to print the environment values set.
  • Loading branch information
abhipsaMisra authored Aug 17, 2020
1 parent 1871cfe commit 9a32573
Showing 1 changed file with 6 additions and 3 deletions.
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!"

0 comments on commit 9a32573

Please sign in to comment.