Skip to content

Commit

Permalink
update Az.Bootstrapper for local profile testing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOnlyWei committed Mar 22, 2021
1 parent 5ee8039 commit ebeb3f3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/Az.BootStrapper/Module/Az.Bootstrapper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,20 @@ function Get-AzProfileMap
[CmdletBinding()]
param([Switch]$Update)

$Update = $PSBoundParameters.Update
$azBootStrapperLocalProfile = [System.Environment]::GetEnvironmentVariable("AzBootStrapperLocalProfile","Machine")
if ($azBootStrapperLocalProfile)
{
$scriptBlock = {
Get-Content -Path $azBootStrapperLocalProfile -ErrorAction stop | ConvertFrom-Json
}
$ProfileMap = Invoke-CommandWithRetry -ScriptBlock $scriptBlock
if(!$ProfileMap)
{
throw [System.IO.FileNotFoundException] "Local profile ${azBootStrapperLocalProfile} doesn't exist."
}
return $ProfileMap
}

# If Update is present, download ProfileMap from online source
if ($Update.IsPresent)
{
Expand Down
25 changes: 24 additions & 1 deletion src/Az.BootStrapper/readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
## Run Generation
## Run Generation
In this directory, run AutoRest:
> `autorest`
## Installing Module
Simply run:

```
Install-Module -Name Az.Bootstrapper -Repository <REPOSITORY_CONTAINING_AZ_BOOTSTRAPPER>
```

## Installing Profiles
- To install from online or cached profile, simply run:

```
Set-BootStrapRepo -Repo <REPOSITORY>
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-BootStrapRepo -Repo <REPOSITORY>
Install-AzProfile -Profile <PROFILE_VERSION>
```

---
### AutoRest Configuration
> see https://aka.ms/autorest
Expand Down

0 comments on commit ebeb3f3

Please sign in to comment.