Skip to content

Commit

Permalink
Change env variable retrieval to work on unix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOnlyWei committed Apr 7, 2021
1 parent 27b692d commit c114faa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Az.BootStrapper/Module/Az.Bootstrapper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ function Get-AzProfileMap
[CmdletBinding()]
param([Switch]$Update)

$azBootStrapperLocalProfile = [System.Environment]::GetEnvironmentVariable("AzBootStrapperLocalProfile","Machine")
# Must use Get-Item and not [Environment]::GetEnvironmentVariable since the latter doesn't work on Unix systems.
$azBootStrapperLocalProfile = Get-Item -Path Env:AzBootStrapperLocalProfile -ErrorAction SilentlyContinue
if ($azBootStrapperLocalProfile)
{
$azBootStrapperLocalProfile = $azBootStrapperLocalProfile.Value
$scriptBlock = {
Get-Content -Path $azBootStrapperLocalProfile -ErrorAction stop | ConvertFrom-Json
}
Expand Down
2 changes: 1 addition & 1 deletion src/Az.BootStrapper/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Install-AzProfile -Profile <PROFILE_VERSION>
- To install local profile, set the environment variable AzBootStrapperLocalProfile with the full path to the local profile on your system.

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

0 comments on commit c114faa

Please sign in to comment.