英文:
Creating an Azure VM with powershell
问题
我正在尝试使用以下命令创建一个带有Windows 10专业版的Azure虚拟机,但我无法成功。
我收到了以下错误信息:
我正在尝试查找镜像的名称,但没有成功。
我想要一个非常容易理解的命令。
英文:
I am trying to create an Azure VM with Windows 10 pro with the following command but I am unable.
New-AzVm
-ResourceGroupName "lab2023"
-Name 'vmlab'
-Location "canadacentral"
-Image "win10-22h2-pro"
-VirtualNetworkName "lab2023-vnet"
-SubnetName "lab2023-subnet"
-SecurityGroupName 'labvm-nsg'
-PublicIpAddressName 'vm-ip' `
-OpenPorts 3389
I am trying to find the name of the image, but no luck.
I want to make it very easy command to understand
答案1
得分: 0
Image
参数是一个结构化数值,由几个信息片段构建而成,详见文档:
> 现在,您可以将所选发布商、产品、SKU和版本合并为一个URN(用冒号分隔的值)。在使用New-AzVM cmdlet创建虚拟机时,将此URN传递给-Image参数。您还可以在URN中用latest替换版本号,以获取图像的最新版本。
一些图像URN的示例在这里。尽管我找不到Windows 10的示例,生成的命令看起来像:
New-AzVm
-ResourceGroupName "myResourceGroupVM"
-Name "myVM2"
-Location "EastUS"
-VirtualNetworkName "myVnet"
-SubnetName "mySubnet"
-SecurityGroupName "myNetworkSecurityGroup"
-PublicIpAddressName "myPublicIpAddress2"
-ImageName "MicrosoftWindowsServer:WindowsServer:2016-Datacenter-with-Containers:latest"
-Credential $cred
-AsJob
英文:
The Image
parameter is a structured value built up from several pieces of information as per documentation:
> Now you can combine the selected publisher, offer, SKU, and version into a URN (values separated by :). Pass this URN with the -Image parameter when you create a VM with the New-AzVM cmdlet. You can also replace the version number in the URN with latest to get the latest version of the image.
Some examples of image urns are here although I cannot find one for Windows 10, and the resulting command looks like:
New-AzVm
-ResourceGroupName "myResourceGroupVM"
-Name "myVM2"
-Location "EastUS"
-VirtualNetworkName "myVnet"
-SubnetName "mySubnet"
-SecurityGroupName "myNetworkSecurityGroup"
-PublicIpAddressName "myPublicIpAddress2"
-ImageName "MicrosoftWindowsServer:WindowsServer:2016-Datacenter-with-Containers:latest"
-Credential $cred
-AsJob
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论