Skip to content

Instantly share code, notes, and snippets.

@ivangeorgiev
Created January 29, 2020 13:29
Show Gist options
  • Save ivangeorgiev/95d944dd7a072809c13a96f26b00adf8 to your computer and use it in GitHub Desktop.
Save ivangeorgiev/95d944dd7a072809c13a96f26b00adf8 to your computer and use it in GitHub Desktop.
Templatize Json (Azure ARM Parameters File)
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