Skip to content

Commit c114faa

Browse files
committed
Change env variable retrieval to work on unix
1 parent 27b692d commit c114faa

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Az.BootStrapper/Module/Az.Bootstrapper.psm1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,11 @@ function Get-AzProfileMap
169169
[CmdletBinding()]
170170
param([Switch]$Update)
171171

172-
$azBootStrapperLocalProfile = [System.Environment]::GetEnvironmentVariable("AzBootStrapperLocalProfile","Machine")
172+
# Must use Get-Item and not [Environment]::GetEnvironmentVariable since the latter doesn't work on Unix systems.
173+
$azBootStrapperLocalProfile = Get-Item -Path Env:AzBootStrapperLocalProfile -ErrorAction SilentlyContinue
173174
if ($azBootStrapperLocalProfile)
174175
{
176+
$azBootStrapperLocalProfile = $azBootStrapperLocalProfile.Value
175177
$scriptBlock = {
176178
Get-Content -Path $azBootStrapperLocalProfile -ErrorAction stop | ConvertFrom-Json
177179
}

src/Az.BootStrapper/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Install-AzProfile -Profile <PROFILE_VERSION>
2020
- To install local profile, set the environment variable AzBootStrapperLocalProfile with the full path to the local profile on your system.
2121

2222
```
23-
[Environment]::SetEnvironmentVariable("AzBootStrapperLocalProfile", <PATH_TO_PROFILE_JSON>, [System.EnvironmentVariableTarget]::Machine)
23+
Set-Item -Path Env:AzBootStrapperLocalProfile -Value <FULL_PATH_TO_PROFILE_JSON>
2424
Set-BootStrapRepo -Repo <REPOSITORY>
2525
Install-AzProfile -Profile <PROFILE_VERSION>
2626
```

0 commit comments

Comments
 (0)