scv
scv

Reputation: 363

Create Image from CIS Image - what's Plan Info for SharedImageVersion type?

I have successfully created a non-CIS virtual machine from the Azure marketplace (Windows Server 2022 Datacenter -x64 Gen2).

The objective is take a CIS image and use Azure Image Builder to create a golden (base) image.

From what I have tried and read, it doesn’t look like it’s possible to take a CIS L1 or L2 Azure marketplace image and customize it with Azure Image Builder:

CIS Windows 2019 Azure Images not supported by Packer

custom_data_file for Windows

I am hoping the work-around is that we:

  1. Create a vm from a CIS L1 Azure marketplace image
  2. Enable WinRM
  3. Sysprep and generalize the vm
  4. Create a custom image and store it in the Azure image gallery
  5. Use Azure Image Builder to customize a golden image

In step #5, I started with the Source looking like this:

"source": {
  "type": "SharedImageVersion",
  "imageVersionID": "/subscriptions/somesubid/resourceGroups/myRg/providers/Microsoft.Compute/galleries/mygal/images/mywinimage/versions/latest"
},

Encountered a deployment failure.

VMMarketplaceInvalidInput : Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request.

I am unable to find documentation on what does SharedImageVersion looks like with planInfo.

Here’s my guess:

"source": {
  "type": "SharedImageVersion",
  "imageVersionID": "/subscriptions/somesubid/resourceGroups/myRg/providers/Microsoft.Compute/galleries/mygal/images/mywinimage/versions/latest",
  "planInfo": {
    "planName": "cis-windows-server-2022-l1",
    "planProduct": "cis-windows-server-2022-l1-gen2",
    "planPublisher": "center-for-internet-security-inc"
  }
},

Again, got the same error:

VMMarketplaceInvalidInput : Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request.

Do you know how it should look like for SharedImageVersion for plan info or is there another approach?

TIA!

Upvotes: 1

Views: 1170

Answers (1)

Imran
Imran

Reputation: 5560

Created Azure virtual machine non-cis and generalized the vm:

To generalize vm -> connect with virtual machine -> Win+R -> type sysprep and select generalize and shutdown like below:

enter image description here

Deallocated the virtual machine click on capture to create an image.

enter image description here

In the image create a gallery or select existing gallery, in the target vm image definition create a custom image with Publisher, offer, SKU like below:

enter image description here

Once deployed on your resource group in vm definition click on version you can create custom image vm directly.

enter image description here

enter image description here

Or you can create a virtual machine, in image select shared image like below:

enter image description here

Now, custom image sourced from a Marketplace image deployed successfully like below:

enter image description here

Upvotes: 0

Related Questions