File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,19 @@ function Get-ALZConfig {
1515
1616 # Import the config from the json file inside assets and transform it to a PowerShell object
1717 if ($configFilePath -ne " " ) {
18- $config = Get-Content - Path $configFilePath | ConvertFrom-Json
18+ $extension = (Get-Item - Path $configFilePath ).Extension.ToLower()
19+ if ($extension -eq " .yml" -or $extension -eq " .yaml" ) {
20+ if (! (Get-Module - ListAvailable - Name powershell- Yaml)) {
21+ Write-Host " Installing YAML module"
22+ Install-Module powershell- Yaml - Force
23+ }
24+ $config = [PSCustomObject ](Get-Content - Path $configFilePath | ConvertFrom-Yaml )
25+ } elseif ($extension -eq " .json" ) {
26+ $config = Get-Content - Path $configFilePath | ConvertFrom-Json
27+ } else {
28+ throw " The config file must be a json or yaml file"
29+ }
30+
1931 return $config
2032 }
2133
You can’t perform that action at this time.
0 commit comments