Azure RHEL Linux VM updates , Gen2 supported? - azure

I am trying to add a RHEL8.2Gen2 VM to automated patching but its failing . I get the hybrid runbook worker is not running error when I run the trouble shooter.
I also get the following error when I go to the "Check For Updates" option on the VM page .
Update operation on 'Microsoft.Compute/virtualMachines', machine:
'hexdev-linux02-RHEL8.2'. Error details:
{"error":{"code":"BadRequest","message":"The selected VM image is not
supported for VM Guest patch operations. Learn more at:
https://aka.ms/VMGuestPatchingCompatibility"}}
Looking at the webpage the error advises me to look at it says RHEL8.2 is supported, but it does not mention anything about Gen1 or Gen2 VMs.
Everything works when I use a Gen1 type VM image for the same RHEL8.2 distro.
Can anyone confirm if Check for Updates and automated patching for RHEL8.2 image should work if you use a Gen2 VM?

Please check this RHEL 8 image types Gen 2 type VM image will not work
Generation 2 doesn't support the operating system you want to run on the virtual machine.
Generation 2 doesn't support the boot method you want to use and Gen 2 are not available in every region it's depends upon the availability of the VM size. see Hyper-V feature compatibility by generation and guest.
Features included in generation 2
Increased memory, Intel Software Guard Extensions (Intel SGX), and virtualized persistent memory
Uses new UEFI-based boot architecture rather than the BIOS-based architecture used by generation 1
Note: Once you created virtual machine's generation you won't be able to change generation so, please considerations before you choose a generation. I would advise you to use Gen1 as it is right now.
For more information in detail, please refer below links:
Support for generation 2 VMs on Azure
Should I create a generation 1 or 2 virtual machine in Hyper-V
Automatic VM guest patching for Azure VMs

Related

Is it possible to change the image running on a virtual machine in Azure without recreating it

Our development environment has a bunch of virtual machines running different versions of our software. I want to be able to replace the Managed Image that is running on a VM, without having to destroy and recreate it.
The images are created using packer, which provisions them with the correct software and dependencies.
Example of Current Workflow:
Machine A is running on Managed Image v2.5, which runs software with a dependency on Tomcat 10.
To fix a bug in v2.2, which depends on Tomcat 9 and thus cannot run on the same VM without changing the dependencies, I have to:
Destroy the VM
Recreate it using the same arguments (name, size, etc) but based on Managed Image v2.2
Attach the network interface and disks
Restart it
If feel like there should be an easier solution to this, where it is possible to hot-swap the images, without recreating the full virtual machines. I've looked into swapping the OS disk, but I couldn't figure out a solution that would work with Managed Images instead of VHD's.
As per official article, its not Supported.
Microsoft does not support an upgrade of the operating system of a
Microsoft Azure virtual machine. Instead, you should create a new
Azure virtual machine that is running the supported version of the
operating system that is required and then migrate the workload.
Official article : https://support.microsoft.com/en-us/help/2721672/microsoft-server-software-support-for-microsoft-azure-virtual-machines
Instead you can use windows server migration tool that would assist you in roles and feature's migration
Install, use, and remove Windows Server migration tools
Similar issue discussed at Can you do in-place updating/upgrading of Azure VM Operating System?

How to create Azure VM with smaller storage

The default Disk Size when creating a VM in azure is 30GB. I only use around 3GB of it. Now, Azure offers a 4GB disk, at a sixteenth of the cost. They decided to make it SO complicated to make it 4GB or 8GB, instead of just offering as an option when creating a VM.
All I need to do is to create a new 4GB managed disk.
How do I get the VHD file for ubuntu so I can finally make the disk? I was looking everywhere but can't find the answer.
EDIT:
As mentioned in the comments, what you require is the Desktop version of Ubuntu and not the Server one. In addition to Ubuntu NOT providing any Azure-compatible Desktop version of Ubuntu, Azure only endorses the Ubuntu versions below:
Ubuntu Server and Pro. 16.x, 18.x, 20.x
Information about extended support for Ubuntu 12.04 and 14.04 can be found here: Ubuntu Extended Security Maintenance.
Additional distro support info here too.
For the images below, you rightly pointed out (apologies for overlooking) that it will still provide you with a 30GB image after conversion.
Also, because Ubuntu Server and Desktop editions share the same kernel, it should be possible for you to follow the same steps to download and create your custom image by following the same prep steps outlined for non-endorsed distros, convert it to VHD and then upload it. Even if this is successful, it's also possible that it will cause some other issues with underlying Azure services.
One last option I thought of is using Azure Migrate to move an existing on-premises Ubuntu VM to Azure. This option failed when we tried but I should disclose our VM was running a much older version of CentOS. When using Azure Migrate, Azure will analyse your machine and tell you whether your VM is supported.
Original Answer:
So here's the thing - you can only use images that are in an Azure Storage Account. Although it seems you've been through a lot already, I'm afraid it doesn't get any easier but steps are generally clear on how it can be done.
1 - Get the image
The Azure documentation on the topic actually recommends to download it from the official Ubuntu cloud repository.
Note
Before attempting to create your own custom Ubuntu image for Azure, please consider using the pre-built and tested images from https://cloud-images.ubuntu.com/ instead.
You can also just download one of the two versions listed on the documentation - this will provide you with a .VHDX file.
2 - Convert the VHDX to VHD
Azure does not support the .VHDX format. See:
The VHDX format is not supported in Azure, only fixed VHD. You can convert the disk to VHD format using Hyper-V Manager or the Convert-VHD cmdlet.
Here's an article which explains how to do this with both options.
3 - Upload the VHD to Blob
Once you have the file in VHD format, you can now upload it to Azure.
You can use AzCopy which is rather complicated when compared to a direct upload, but just mentioning that this can also be done. It also seems to be the recommended approach from Azure.
The easiest option is to upload manually through the Portal. See this article that goes into details - pick what's relevant to you.
(a) Choose your storage account, create/select a container you want to upload to
(b) Click Upload and select the Ubuntu VHD file to upload.
Ensure that the Blob type is set to Page Blob.
4 - Create a Managed Disk and VM
Once your Ubuntu VHD is uploaded, go to its properties page and get the blob URI.
Use that when creating the disk.
Create a VM from the managed disk.
That should be all - it's very painful but possible
I managed to go as low as to just 3 GB and have Ubuntu 20.04 LTS (Focal Fossa) running as an Azure VM.
Prerequisites are below mentioned images downloaded from https://cloud-images.ubuntu.com/focal/current/, a tool to convert VMDK to VHD (e.g. 2Tware Convert VHD) and Hyper-V Manager installed/turned on under local Windows features.
I couldn’t go that low when using the dedicated focal-server-cloudimg-amd64-azure.vhd.zip. When unpacked the file livecd.ubuntu-cpc.azure.vhd is 30-31 GB large. I didn’t manage to shrink it (only an expansion was possible), so the result would have been worse than the original (30GB) Ubuntu VMs from Azure Marketplace.
I have downloaded focal-server-cloudimg-amd64.vmdk instead. Here a conversion to VHD was needed with help of 2Tware Convert VHD. Unfortunately, if uploaded to Azure this image is not accepted as it is a Dynamic VHD.
I had to use Hyper-V Manager to convert it to fixed. Here however I faced one another issue. When in Hyper-V Manager going through Edit Disks…->Browse…->Convert->VHD->Fixed the file I was getting was 10 GB large (noticeable improvement, but still larger than the final 3 GB).
Instead of going through Edit Disks… I went for Quick Create… of a new Virtual Machine. I chose Local installation source and selected the VHD file converted from VMDK. Finally, I clicked Create Virtual Machine.
The VM is created, but there is no need to connect to it. In fact, it can be deleted right away, as what is really needed is the file (presumably) stored as New Virtual Machine.vhdx under C:\Users\Public\Documents\Hyper-V\Virtual hard disks\.
With help of Hyper-V Manager this time I managed to both convert the file to Fixed VHD as well as to shrink it to 3 GB.
Later the process is as described in #Ked Mardemootoo’s answer (the instruction from IBM). A new Storage account needs to be created in Azure. Then in the Storage Account a new blob Container needs to be created. The VHD file is to be uploaded to the Container. Later a new Image needs to be created from this Storage blob and from this image a new small VM can be successfully created.

Factory reset Windows Server 2016 on Azure

I installed a few beta version of some apps and now the functionality of the Windows is broken.
Is there any way I can reset the windows to it's initial state from the portal or I have to remove it and create a new one?
If you have not backup this VM or take a snapshot of this VM, we should re-create a new VM.
As mentioned by Jason, if a backup or a snapshot was taken, you could use them to recover the VM.
You have mentioned, ‘now the functionality of the Windows is broken’, unsure if you are facing some boot issue or something else. Please do let me know if feasible, you could look at fixing the underlying issue. Or just recreate the problematic VM and not the entire Resource Group itself.
I would like to highlight the process of recovering the OS below:
Delete the VM encountering issues, keeping the virtual hard disks.
Attach and mount the virtual hard disk to another Windows VM for troubleshooting purposes.
Connect to the troubleshooting VM. Edit files or run any tools to fix issues on the original virtual hard disk.
Unmount and detach the virtual hard disk from the troubleshooting VM.
Create a VM using the original virtual hard disk.
Refer the document for more details on this process.

Reuse preinstalled software in Azure

Sometimes installing new software takes a lot of time.
I would like to install software in the VM and reuse this software later in new VMs. There are two ways to do that.
create an image after installations as described here or
use the VHD disk with the OS and preinstalled software (e.g. C:)?
In the first case I would just create a new VM directly from that image, in the second case I would attach the disk after the new VM is created.
Which way is preferable and possible at all?
Let me try to address your two points below.
1) An image is really about creating a sys prepped [1] version from an existing Azure VM ( that presumably has all the software you need installed).
Once you have captured the image, you can then create additional VM(s) based on it.
You can also go Azure Marketplace or VM Depot [2] and choose from a set of pre-built images and easily spin VMs based on it. This is the quickest way to get up and running with a VM.
2)
A disk is created from an image when you provision a VM. By default an OS disk will be created. But if your image includes data disks those will also be added to the VM.
To your point, #2 allows you to attach additional data disks (number of disks you can attach depends on the size of the VM you are creating). Note that you can attach an empty or an existing disk.
[1]
https://technet.microsoft.com/library/bb457073.aspx
[2]
http://azure.microsoft.com/en-us/marketplace/virtual-machines/

Azure Virtual Machine Capture

I have a Windows Server running as a Virtual Machine on Azure that I have installed SQL Enterprise on. I installed SQL Server onto a new drive (E:) so that the C: drive would remain for the OS.
I followed the instructions on how to use sysprep and basically capture the image to use going forward for new instances. After following these steps and deploying a new vm with this image, nothing worked. It thought SQL was installed (it wasn't). It also didn't know anything about the additional drives or VHDs.
I came across this Blog post from the Azure team and it references a powershell command Save-AzureVMImage that may be what I'm looking for with the new "Virtual Machine Image".
Ultimately what I want is to have an image that I can use to deploy a new fully functional Windows Server instance with SQL Enterprise installed and the additional VHDs being used... Can someone point me in the right hemisphere on this please...
Save-AzureVMImage until the build 2014 only captures OS disk and not the data disk, since your SQL is installed on a separate mapped drive a data disk. That will not be part of the snapshot\sysprep process.
There is something called VMImages recently launched which captures data disks along side OS disks.You will have to update Azure Commandlets to find more options while capturing Image of a running VM, Refer to the blogs below for more detailed solution
http://vishwanathsrikanth.wordpress.com/2014/04/16/windows-azure-vmimages-updates-to-clonevm-powershell-script/
http://blogs.msdn.com/b/windowsazure/archive/2014/04/14/vm-image-blog-post.aspx
Happy Coding !!

Resources