I have below Json file with content:
InitialApiConnectionTemplateFile.json:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_$APIConnectionName_name": {
"defaultValue": "$APIConnectionName",
"type": "String"
}
},
"variables": {},
"resources": []
}
The string $APIConnectionName
which is I want to replace.
But I use the -replace like below:
$JsonData = Get-Content $(System.DefaultWorkingDirectory)\InitialApiConnectionTemplateFile.json | ConvertFrom-Json
$JsonData -replace '$APIConnectionName', 'TestValue'
$JsonDataNew = $JsonData | ConvertTo-Json -depth 100
Write-Host "$JsonDataNew "
But it wot work for me. Please help.