我正在尝试基于现有的ARM模板创建一个新的Azure ARM部署文件。具体来说,我的步骤如下:
我尝试设置它的值(
因此,在我的PShell中,我的VMObjectFile就像这样读取:
但是我该如何删除整个树?我已经摆脱了“id”值,之后可以将
但是我要如何完全从子树
- 导出虚拟机的JSON文件
- 将JSON文件转换为PShell中的对象
- 进行更改
- 编写新的JSON文件
storageprofile.imagereference
,需要从新的JSON文件中删除它。我尝试设置它的值(
storageprofile.imagereference.id=$null
),但ARM不喜欢这个操作,并希望整个storageprofile.imagereference
条目被删除。因此,在我的PShell中,我的VMObjectFile就像这样读取:
$VMObjectFile = (Get-Content $ImportFile | Out-String | ConvertFrom-Json)
我想要删除的属性设置在:
$VMObjectFile.resources.properties.storageProfile.imageProfile
但是我该如何删除整个树?我已经摆脱了“id”值,之后可以将
$VMObjectFile.resources.properties.storageProfile.imageProfile
设置为$null
(删除id属性)。但是我要如何完全从子树
$VMObjectFile.resources.properties.storageProfile
中删除imagereference,因为该路径下仍然存在多个条目:$VMObjectFile.resources.properties.storageProfile.osDisk
$VMObjectFile.resources.properties.storageProfile.dataDisk