Error Failing to Create VM off Image from CIS VM from Marketplace
Product Name
CIS Hardened Images® (Azure)
Product Version
Date
Dec 8, 2021
Problem
A user creates a CIS VM from Azure Marketplace after purchasing. The user then deprovisions, dellocates, generalizes that VM and creates an image from it. Upon creating a VM off that image, the VM fails to create with error message similar to:
","details":[{"code":"VMMarketplaceInvalidInput","message":"Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. VM: '/subscriptions/95a577ee-21c2-4fd5-9baf-dc9bcac91e07/resourceGroups/cisLinux/providers/Microsoft.Compute/virtualMachines/cisub20-offimg'."}]}
Solution
Create CIS HI of choice from Marketplace
SSH into the CIS Marketplace HI and deprovision
To do this: run the commands below as on the CIS Marketplace HI
sudo -s waagent -force -deprovision export HISTSIZE=0
Stop the VM in Dashboard
Wait until Marketplace VM is stopped and run CLI as administrator and sign into Azure CLI
Run deallocate $ az vm deallocate --resource-group [insert rg name] --name [insert name of marketplace cis hi] Run Generalize $ az vm generalize --resource-group [insert rg name] --name [insert name of marketplace cis hi] Create Image $ az image create --resource-group [insert rg name] --name [insert name you want image to have] --source [insert name of marketplace cis hi] --location "[insert location]"
Go to Dashboard and ensure image is created from Azure CLI
Create VM off the image through the dashboard
When creating a VM off the image, “plan information” must be included in the VM deployment. This is an Azure process that CIS has no control or input on.
When creating a VM off an image through the dashboard, go to the image and create VM off the image as you normally would. Fill in all information (resource group, VM name, user name and pass or key, network security group, etc.)
When you get to the “Review and create” page click the “Download a template for automation” link at the bottom of the page
Click “Deploy” then “Edit Template”
Locate the section of the template that has the parameters defined for virtual machine and add the plan information below the location section
"plan": { "name": "cis-ubuntu2004-l1", "publisher": "center-for-internet-security-inc", "product": "cis-ubuntu-linux-2004-l1" },
See example above - make sure alignment/syntax is correct
Save and create (will likely need to type in password again so scroll down on the page and fill that in)
Create
Keywords;
Content by Label