【发布时间】:2019-09-23 18:43:22
【问题描述】:
我需要通过可在 CI 管道中调用的脚本在 Azure 中创建 Windows 10 VM,以便创建用于自动化 UI 测试的嵌套 android 模拟器。该脚本使用新的 Azure powershell 模块(在本例中为 Az.Compute)创建 VM,但似乎 cmdlet New-AzVm 仅在其 -ImageName 参数中接受有限的图像名称列表。有没有办法向这个 cmdlet 指定我要创建 Windows 10 虚拟机?
我已尝试将格式 Publisher:Offer:Sku:Version 用于 Windows 10 Pro 映像,但无法识别此格式。
$ImageName = "MicrosoftWindowsDesktop:Windows10:rs5-pro:latest"
# Create the VM
New-AzVM `
-ResourceGroupName $ResourceGroup `
-Name $VmName `
-Location $Location `
-ImageName $ImageName `
-Size $VmSize `
-VirtualNetworkName $VnetName `
-SubnetName $SubnetName `
-SecurityGroupName $NsgName `
-PublicIpAddressName $PipName `
-Credential $Cred `
-OpenPorts 3389 `
-Verbose
我希望在我的 azure 资源组中创建一个 Windows 10 虚拟机,但收到以下错误:
New-AzVM:工件:未找到 VMImage。 在行:1 字符:1 + New-AzVM -ResourceGroup androidexample -Location eastus -ImageName "M ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzVM], CloudException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
【问题讨论】:
标签: azure powershell android-emulator windows-10 azure-powershell