我正在尝试使用 PowerShell 创建一个 Ubuntu DSVM。我已经确定 Ubuntu DSVM 映像是由 publisher microsoft-ads
、 under offerlinux-data-science-vm-ubuntu
和 SKU发布的linuxdsvmubuntu
。我收集到在 PowerShell 中指定我的 VM 配置时,我需要使用Set-AzureRmVMPlan
and Set-AzureRmVMSourceImage
,并尝试了以下操作:
$vmConfig = New-AzureRmVMConfig -VMName $vmName -VMSize Standard_D4s_v3
$vmConfig = Set-AzureRmVMPlan -VM $vmConfig -Name "linuxdsvmubuntu" -Product "linux-data-science-vm-ubuntu" -Publisher "microsoft-ads"
$vmConfig = Set-AzureRmVMOperatingSystem -VM $vmConfig -Linux -ComputerName $vmName -Credential $cred
$vmConfig = Set-AzureRmVMSourceImage -VM $vmConfig -PublisherName "microsoft-ads" -Offer "linux-data-science-vm-ubuntu" -Skus "linuxdsvmubuntu" -Version latest
$vmConfig = Add-AzureRmVMNetworkInterface -VM $vmConfig -Id $nic.Id
New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vmConfig
不幸的是,我从New-AzureRmVM
命令中收到一条错误消息:
New-AzureRmVM : This resource was created without a plan. A new plan cannot be associated with an update.
ErrorCode: CannotSetPlanOnUpdate
ErrorMessage: This resource was created without a plan. A new plan cannot be associated with an update.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 648c62cd-4029-408e-8b6c-2ae4310001f6
At line:1 char:1
+ New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vmC ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmVM], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand
看来我可能没有Set-AzureRmVMPlan
正确使用。任何人都清楚我做错了什么吗?