AL/Get-EnvironmentKeyValue.ps1
function Get-EnvironmentKeyValue { Param( [Parameter(Mandatory=$false)] [string]$SourcePath = (Get-Location), [Parameter(Mandatory=$true)] [string]$KeyName ) if (!(Test-Path (Join-Path $SourcePath 'environment.json'))) { return $null } $JsonContent = Get-Content (Join-Path $SourcePath 'environment.json') -Raw $Json = ConvertFrom-Json $JsonContent if ($null -ne $Json.PSObject.Properties.Item($KeyName)) { return $Json.PSObject.Properties.Item($KeyName).Value } return $null } Export-ModuleMember -Function Get-EnvironmentKeyValue |