Created
January 29, 2020 13:29
-
-
Save ivangeorgiev/95d944dd7a072809c13a96f26b00adf8 to your computer and use it in GitHub Desktop.
Templatize Json (Azure ARM Parameters File)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Templetize-ArmTemplateParams { | |
param( | |
$InputParamsFile | |
) | |
$json = Get-Content $InputParamsFile | Out-String | ConvertFrom-Json | |
foreach($param in $json.parameters.PSObject.Properties) | |
{ | |
$json.parameters."$($param.Name)".value = "`${$($param.Name)}" | |
#Write-Host "$($param.Name)=$($param.Value.value)" | |
} | |
return $json | ConvertTo-Json -Depth 10 | |
} | |
# Sample usage: | |
# Templetize-ArmTemplateParams arm_template_parameters.json | |
# | Out-File $conf['OutputParamsFile'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment