Azure Windows门户:无法保存图像以创建VHD

Ati*_*ska 3 powershell publish azure-storage azure-marketplace azure-management-portal

我正在尝试在Azure市场上发布我的产品.

我正在使用我用来创建VM的Windows 2012 R2 Datacenter portal.azure.com.我按照运行sysprep,概括它然后创建容器的步骤.

在那之后,当我们运行save-azurermvmimage捕获图像时,我得到the capture action is only supported on a virtual machine with blob based disks. please use the image resource apis to create an image from a managed virtual machine 所以我无法在容器中获取图像URL.有什么我做错了吗?请指导!

Jas*_* Ye 7

托管磁盘与非托管磁盘不同.我们可以使用Powershell创建托管图像,但我们无法在我们的存储帐户中找到这个新图像,由Azure管理托管磁盘,我们无法直接管理它.

要创建VM的托管映像,我们可以按照以下步骤操作:

运行sysprep以概括 Windows VM.(此过程在捕获原始虚拟机后删除.在捕获Azure虚拟机的映像之前,建议备份目标虚拟机.)

$vmName = "myVM" 
$rgName = "myResourceGroup" 
$location = "EastUS" 
$imageName = "myImage"
Stop-AzureRmVM -ResourceGroupName $rgName -Name $vmName -Force
Set-AzureRmVm -ResourceGroupName $rgName -Name $vmName -Generalized
$vm = Get-AzureRmVM -Name $vmName -ResourceGroupName $rgName
$image = New-AzureRmImageConfig -Location $location -SourceVirtualMachineId $vm.ID 
New-AzureRmImage -Image $image -ImageName $imageName -ResourceGroupName $rgName
Run Code Online (Sandbox Code Playgroud)

完成后,我们可以在这里找到这个图像: 在此输入图像描述

有关创建托管图像的更多信息,请参阅此链接.

顺便说一句,我们应该使用Azure PowerShell 3.7.0或更高版本.

PS C:\Users> Get-Module -ListAvailable -Name Azure -Refresh


    Directory: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.7.0      Azure                               {Get-AzureAutomationCertificate, Get-AzureAutomationConnec...
Run Code Online (Sandbox Code Playgroud)