powershellazure-storagepublishazure-marketplaceazure-management-portal

Azure Windows Portal: Unable to Save Image in order to create VHD


I am trying to publish my product on Azure marketplaces.

I am using windows 2012 R2 Datacenter that I use to create a VM from portal.azure.com. I followed steps of running a sysprep, generalizing it and then creating containers.

After that when we run save-azurermvmimage to capture image, I get the capture action is only supported on a virtual machine with blob based disks. please use the image resource apis to create an image from a managed virtual machine So I am not able to get the image url in container. Is there anything I am doing wrong? Please guide!


Solution

  • @Jason Ye: I was able to solve my problem and publish. I stopped using powershell and used only azure portal to do all the steps. The MS documentation provided is fragmented and new, old versions are combined even though they are deprecated. They are written in a way assuming that the reader has already experienced doing things.

    So after lot of work done, I eventually came up with these steps:

    1. Compute new VM Windows Server 2012 R2 Datacenter.
    2. Follow the creation steps but use unmanaged disk so as to manage storage account. Keep track of all the names you are giving, specifically VM, Storage account name and username/password. This authentication will be used in step 5.
    3. Once created, VHD url is stored in storage account created which can be seen in Disks section under VM too (127Gib size is displayed).
    4. Login to VM by using the 'Connect' button on portal and rdp with credentials you provided while creating VM in steps 2/3. If you don't see that, then you will need to add rdp port in Inbound rules.
    5. Once logged in, check and run windows required updates (leave optional) and install your software and do whatever is needed for your Software.
    6. Once this is done, run sysprep with Generalize and Shutdown options.
    7. Sysprep shuts down the virtual machine, which changes the status of the virtual machine in the Azure portal to Stopped (Deallocated).
    8. Create Image by clicking Images -> Add, as shown below. Use new resource group and in Storage Blob field, browse for the storage account created in step 3.
    9. Your storage account will have a container with default name as 'vhds'. Your .vhd is inside this folder. If you don't see your account, you are either checking with wrong name or you ended up creating a managed disk.
    10. Once the image is created, create VM from the newly created image. In console, if you click on this image, then there will be an option 'Create VM' (use the existing resource group created above for the image). This time it’s a managed VM as the VM is created from the image (mentioned in the ‘i’ section).
    11. You can login to this newly created (second) VM and check your data, if it's there in a folder in c: drive. If you don't see 'Connect' button, then add rdp port in Inbound rules.
    12. Stop the VM in step 4/5 by clicking the Stop button in portal.
    13. Download and install Microsoft Storage Explorer.
    14. Search for the storage account created in step 2/3. Expand it and go to the lowest hierarchy. Click on it and on the right side menu, you will see your vhd. Right click and 'Get Shared Access Signature'.
    15. Select 'Generalize...' check box. Enter the start date one day before the current date and expiration date one month from the current (> 7 days from current). Copy the the signature url and save it.
    16. Now, go to the publishing portal: https://cloudpartner.azure.com and create offer. Fill in the necessary fields. In SKU's tab, you have to add a New VM image where Disk Version can be anything in the number.number.number format and OS VHD URL will be the above copied signature url.