我已在 Azure 中使用托管磁盘创建了新的 VM。现在我想将其转换为非托管磁盘。有可能吗?
最佳答案
now i want to convert it to Unmanaged disk. Is it Possible?
无法直接将其转换为非托管磁盘。
作为解决方法,我们可以将 VHD 从托管磁盘复制到非托管磁盘,然后使用此 VHD 创建新的虚拟机。
我们可以使用 PowerShell 命令来做到这一点:
$sas = Grant-AzureRmDiskAccess -ResourceGroupName "[ResourceGroupName]" -DiskName "[ManagedDiskName]" -DurationInSecond 3600 -Access Read
$destContext = New-AzureStorageContext –StorageAccountName "[StorageAccountName]" -StorageAccountKey "[StorageAccountAccessKey]"
$blobcopy=Start-AzureStorageBlobCopy -AbsoluteUri $sas.AccessSAS -DestContainer "[ContainerName]" -DestContext $destContext -DestBlob "[NameOfVhdFileToBeCreated].vhd"
复制完成后,我们就可以使用新的VHD来创建虚拟机了。
这是一个template关于使用现有VHD和现有Vnet创建Azure虚拟机,请引用。
关于azure - 是否可以将 Azure VM 从托管磁盘转换为非托管磁盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45566291/