[英]Azure bicep template tag OSDisk throws error on 'deleteOption' setting
我正在嘗試使用 bicep 文件創建一個 Azure VM:
resource linuxVm 'Microsoft.Compute/virtualMachines@2020-06-01' = {
name: linuxVm.vmName
location: location
properties: {
hardwareProfile: {
vmSize: linuxVm.vmSize
}
storageProfile: {
osDisk: {
createOption: 'FromImage'
deleteOption: 'Delete' //This line throws error
managedDisk: {
storageAccountType: linuxVm.osDiskType
}
}
當我想刪除 VM 時,我希望操作系統磁盤也被刪除,因此設置此選項: deleteOption: 在 storageprofile 部分中的“刪除” 。
但是在部署二頭肌期間出現此錯誤:
"BadRequest","message": "Could not find member 'deleteOption' on object of type 'OSDisk'. Path 'properties.storageProfile.osDisk.deleteOption', line 1, position 231."target": "vm.properties.storageProfile.osDisk.deleteOption
這里有什么錯誤? 謝謝
我在我的環境中嘗試並得到以下結果:
最初,當我在我的環境中嘗試使用版本[2020-06-01]
linuxVm 'Microsoft.Compute/virtualMachines@2020-06-01'
時。 我得到了同樣的錯誤。
根據MS-DOCS ,我嘗試使用文檔版本為 [ 2021-11-01
]** 的資源虛擬機,即 bicep 格式vm 'Microsoft.Compute/virtualMachines@2021-11-01'
**。
安慰:
傳送門:使用上面的Microsoft bicep code with version。 我能夠使用deleteOption: 'Delete'成功部署虛擬機。
安慰:
我還使用json view
檢查了門戶:
在我的環境中,我手動刪除了虛擬機以檢查要刪除的os disk
,它成功地完美地刪除了Virtual machine and os disk
。
結果:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.