使用PowerShell部署Ubuntu DSVM时创建计划失败求助
Fixing "Create Plan Failed" Error When Provisioning Ubuntu DSVM via PowerShell
Let's tackle that "Create Plan Failed" error you're hitting when trying to spin up an Ubuntu Data Science VM (DSVM) via PowerShell. I’ve worked through similar issues with Azure Marketplace images, so here’s what’s likely going wrong and how to fix it:
Common Root Causes
The most frequent issues here are:
- Missing required parameters in the
Set-AzureRmVMPlancommand (you need all three: Publisher, Product, and SKU/Name) - Not accepting the Azure Marketplace terms for the DSVM image before deployment
- Using outdated Azure PowerShell modules (AzureRm is deprecated—Az is the current standard)
Step-by-Step Fix with Az Module (Recommended)
First, switch to the modern Az module if you haven’t already (AzureRm is no longer supported). Here’s the full, working script to deploy your Ubuntu DSVM:
# Define your variables $vmName = "YourVMName" $resourceGroupName = "YourResourceGroup" $location = "eastus" # Use your preferred region $adminUsername = "yourAdminUser" $adminPassword = ConvertTo-SecureString "YourStrongPassword" -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword) # 1. Create base VM configuration $vmConfig = New-AzVMConfig -VMName $vmName -VMSize Standard_D4s_v3 # 2. Set the VM Plan (critical for Marketplace images) $vmConfig = Set-AzVMPlan -VM $vmConfig ` -Publisher "microsoft-ads" ` -Product "linux-data-science-vm-ubuntu" ` -Name "linuxdsvmubuntu" # 3. Set the source image (matches the plan parameters) $vmConfig = Set-AzVMSourceImage -VM $vmConfig ` -PublisherName "microsoft-ads" ` -Offer "linux-data-science-vm-ubuntu" ` -Skus "linuxdsvmubuntu" ` -Version "latest" # 4. Add admin credentials $vmConfig = Set-AzVMOperatingSystem -VM $vmConfig ` -Linux ` -ComputerName $vmName ` -Credential $credential # 5. Add a network interface (replace with your existing NIC or create a new one) $nic = Get-AzNetworkInterface -Name "YourNICName" -ResourceGroupName $resourceGroupName $vmConfig = Add-AzVMNetworkInterface -VM $vmConfig -Id $nic.Id # 6. Accept Marketplace terms (only need to run this once per subscription) Get-AzMarketplaceTerms ` -Publisher "microsoft-ads" ` -Product "linux-data-science-vm-ubuntu" ` -Name "linuxdsvmubuntu" | Set-AzMarketplaceTerms -Accept # 7. Deploy the VM New-AzVM -ResourceGroupName $resourceGroupName -Location $location -VM $vmConfig
If You Must Use AzureRm (Deprecated)
If you’re stuck with the old AzureRm module, fix your existing code by adding the missing -Publisher and -Product parameters to Set-AzureRmVMPlan, and ensure you accept the terms:
# Fix your Set-AzureRmVMPlan line $vmConfig = Set-AzureRmVMPlan -VM $vmConfig ` -Name "linuxdsvmubuntu" ` -Publisher "microsoft-ads" ` -Product "linux-data-science-vm-ubuntu" # Accept terms (once per subscription) Get-AzureRmMarketplaceTerms ` -Publisher "microsoft-ads" ` -Product "linux-data-science-vm-ubuntu" ` -Name "linuxdsvmubuntu" | Set-AzureRmMarketplaceTerms -Accept
Key Notes
- Always match Plan and Image parameters: The Publisher, Product, and SKU values must be identical in both
Set-AzVMPlanandSet-AzVMSourceImage(or their AzureRm equivalents). - Accept terms once per subscription: You only need to run the Marketplace terms command one time for your subscription—after that, you can deploy the image as many times as needed.
- Check region availability: Ensure the DSVM image is available in your chosen Azure region. You can verify this with
Get-AzVMImageOffer -Location $location -PublisherName microsoft-ads.
内容的提问来源于stack exchange,提问作者mewahl
相关产品推荐
相关产品推荐

