diff --git a/src/Az.BootStrapper/Module/Az.Bootstrapper.psm1 b/src/Az.BootStrapper/Module/Az.Bootstrapper.psm1 index a78c55b5..ed711454 100644 --- a/src/Az.BootStrapper/Module/Az.Bootstrapper.psm1 +++ b/src/Az.BootStrapper/Module/Az.Bootstrapper.psm1 @@ -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) { diff --git a/src/Az.BootStrapper/readme.md b/src/Az.BootStrapper/readme.md index 720d1359..15e2cf41 100644 --- a/src/Az.BootStrapper/readme.md +++ b/src/Az.BootStrapper/readme.md @@ -1,7 +1,30 @@ - ## Run Generation +## Run Generation In this directory, run AutoRest: > `autorest` +## Installing Module +Simply run: + +``` +Install-Module -Name Az.Bootstrapper -Repository +``` + +## Installing Profiles +- To install from online or cached profile, simply run: + +``` +Set-BootStrapRepo -Repo +Install-AzProfile -Profile +``` + +- To install local profile, set the environment variable AzBootStrapperLocalProfile with the full path to the local profile on your system. + +``` +[Environment]::SetEnvironmentVariable("AzBootStrapperLocalProfile", , [System.EnvironmentVariableTarget]::Machine) +Set-BootStrapRepo -Repo +Install-AzProfile -Profile +``` + --- ### AutoRest Configuration > see https://aka.ms/autorest