gpt4 book ai didi

azure - 如何获取存储在 Azure 资源管理器中的捕获的 VM 镜像的 URL?

转载 作者:行者123 更新时间:2023-12-02 23:14:14 27 4
gpt4 key购买 nike

我正在尝试根据现有 VM 安装的系统准备捕获在 Azure RM 中创建新 VM。即:

$urlOfCapturedImage = <I cannot find this>

...

$vm = Set-AzureRmVMOSDisk -VM $vm -Name $osDiskName -VhdUri $newOsDiskUri `
-CreateOption fromImage -SourceImageUri $urlOfCapturedImage -Windows

New-AzureRmVM -ResourceGroupName $resourceGroupName -Location $location -VM $vm

我当前的问题是找到存储的 VM 镜像的正确 URL,因为它似乎没有作为 VHD blob 存储在我的存储帐户中。相反,我在图像类别中找到它,其中包含以下有限信息:

enter image description here

我尝试过使用以下 URL/URI,但它们都不起作用:

https://<storage-account-name>.blob.core.windows.net/system/Microsoft.Compute/Images/jira-7-sysprep-20170724133831.vhd

/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Compute/images/jira-7-sysprep-20170724133831

有谁知道如何获取我的虚拟机镜像的正确 URL?或者可能只是我使用了错误的方法?

最佳答案

Does anyone know how to get the proper URL for my VM image?

对于 Azure VM 镜像,VHD 由 Azure 管理,您无法获取 URL。

您的命令用于从存储帐户创建虚拟机。如果您想从镜像创建虚拟机,可以使用以下命令从自定义镜像创建虚拟机。

$image = Get-AzureRmImage `
-ImageName myImage `
-ResourceGroupName myResourceGroupImages

# Here is where we specify that we want to create the VM from and image and provide the image ID
$vmConfig = Set-AzureRmVMSourceImage -VM $vmConfig -Id $image.Id

$vmConfig = Add-AzureRmVMNetworkInterface -VM $vmConfig -Id $nic.Id

New-AzureRmVM `
-ResourceGroupName myResourceGroupFromImage `
-Location EastUS `
-VM $vmConfig

更多相关信息请引用此link .

关于azure - 如何获取存储在 Azure 资源管理器中的捕获的 VM 镜像的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45297321/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com