【发布时间】:2020-12-13 18:29:26
【问题描述】:
未能以编程方式从 marketplace image 引发 azure VM。
代码:
var linuxVM = await _azure.VirtualMachines.Define(linuxVmName)
.WithRegion(Region)
.WithExistingResourceGroup(rgName)
.WithNewPrimaryNetwork("10.0.0.0/28")
.WithPrimaryPrivateIPAddressDynamic()
.WithoutPrimaryPublicIPAddress()
.WithSpecificLinuxImageVersion(new ImageReference())
.WithRootUsername(userName)
.WithRootPassword(password)
.WithSize(VirtualMachineSizeTypes.StandardNC6sV3)
.WithPlan(new PurchasePlan("nvidia", "ngc-base-version-20-10-1", "ngc_azure_17_11"))
.CreateAsync();
在 Azure 中,我为给定映像启用了“想要以编程方式部署?开始吧”(如 here 所述)。
关于选择图像的方法有几个选项,不确定应该使用哪种方法以及使用哪些参数。尝试了几种组合,但都返回了 misc 错误消息。
没有找到更详细的代码示例this(它没有解释如何使用来自市场的图像)。
编辑:
上面的代码返回这个异常:
Microsoft.Rest.Azure.CloudException: 'This resource was created without a plan. A new plan cannot be associated with an update.'
另一个使用更多填充参数的尝试导致相同的异常:
.WithSpecificLinuxImageVersion(new ImageReference(new ImageReferenceInner(
publisher: "nvidia",
offer: "ngc_azure_17_11",
sku: "ngc-base-version-20-10-1"
)))
【问题讨论】:
-
可以分享一下错误详情吗?
-
我更新了问题
-
你在哪里可以找到图片参考?
-
这是问题中的第一个链接(“市场图片”):azuremarketplace.microsoft.com/en-us/marketplace/apps/…
标签: c# azure azure-marketplace