0

我正在尝试使用 ARM 模板部署模型自动部署 Azure 数据工厂。作为其中的一部分,我需要修改 ARMTemplateParametersForFactory.json 如下:

从 :

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "dataFactoryName": {
      "value": "GEN-UNIQUE"
    },    
    "dataFactoryLocation": {
      "value": "East US"
    }
  }
}

至 :

{
    "dataFactoryName": {
      "value": "GEN-UNIQUE"
    },    
    "dataFactoryLocation": {
      "value": "East US"
    }
  
}

请建议一种使用命令行或 Azure Powershell 进行上述转换的方法。

更新 :

通过执行以下操作,我能够部分实现我想要的:

$json = Get-Content 'C:\Input.json' | ConvertFrom-Json
$json.PSObject.Properties.Remove("``$schema")
$json.PSObject.Properties.Remove("contentVersion")
$jsonnew = $json | ConvertTo-Json | Out-String
$jsonnew | Out-File -encoding ASCII "C:\Output.json"

如果有人能提供完整的答案,我将不胜感激。谢谢。

4

0 回答 0