Start generalized azure VM - azure

I am working on an azure deployment. I am using some templates from github that creates a certain number of VM's based on a 'master image', puts them behind a load balancer, and allows access to them through RDP and ports.
Now, all this is working great. I build my image, then I run sysprep and generalize it, shut it down, and spin up 40 copies.
The issue I am running into is what do I do if I want to update the 'master image'?
It won't let me boot it up, because it says it is generalized. And I am having a hard time setting up a new vm and attaching the OS disk "not sure if this is the right way"
Does anyone have any suggestions? I am coming from a VMware VDI environment, where I would just boot up the master, make changes, shut down, and snapshot and redeploy.
Also I am using the new Azure interface, which I believe is called AzureRM.
Error message: Operation Start VM is not allowed on VM xxx since the VM is generalized.

Like versioning, you have to create a new VM from the image made before, and then repeat the process again after your changes.

Well, its not pretty, but it should work:
Spin up a fresh copy. make your changes, then preform the sysprep / oobe process again, finally, generalize & capture.

Related

Changing Azure VM state machine

On an Azure environment can I un-generalized a VM to normal state again that I'll be able to use the VM?
When I try it I have an error message saying that the VM is generalized.
Thanks in advance.
I needed to make a duplicate machine from this VM image, BUT since the machine was created without the options to delete the disks, seems like my option is to make another fresh machine, and change the name of it to something else.
I used this video.
https://www.youtube.com/watch?v=ukqbeiejLYE
But now I would like to use the generalized VM normally, can it be done?

Is there a way to start an Azure Virtual Machine when someone try to access it through its DNS name?

For context, we have an Azure Virtual Machine that we use to test our app before pushing the changes to production. This VM automatically shutdown every evening to save some energy. Is there a way to make it start when trying to access its DNS name (******.cloudapp.azure.com)? It would be better than starting it at a fixed time every morning but if it is impossible or too complicated, is there a way to make it start at a specified time?
Starting the vm using events requires some changes in your architecture.
You can start a vm at fixed time using automation accounts. Look at this tutorial on Microsoft learn to accomplish your goal
https://learn.microsoft.com/en-us/azure/automation/automation-solution-vm-management-config
If you had a firewall in front off your VM you could log the HTTP 404 events, then trigger a function that started your VM.
But it is not trivial and the firewall would add extra cost (it may be more expensive than your VM)
So the best way is probably just to start the VM at a fixed time.
If you need the VM permanently you could look into Reserved instances to save costs. It could save you upto 80% https://azure.microsoft.com/en-us/pricing/reserved-vm-instances/

why does "capturing" an image of a VM in Azure prevent the VM from being used?

The Azure portal web interface has several options for creating 'images' of a VM including:
snapshot creates a snapshot of the machine which can presumably be restored or copied (what I am trying to do without much success so far)
capture generalises a VM into an image that can be used to create multiple VMs (in theory)
The capture option makes the original VM unusable. In fact you are prompted about whether you want to keep it as it will no longer run (which indeed it can't).
Why is capture a destructive operation?
When you generalise an image using sysprep it will remove the customisation from your VM and that particular VM be of no use except as a golden image. This golden image then can be used as a template to spin more VM’s by passing on the missing parameters which sysprep removed.
If you like to keep the VM, you are using for capture it is recommended that you make a copy of it first and then use it for capture and sysprep process
Refer below for details
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource
Snapshot is more of a VM state at a given point in time and. Mostly used for migration to another region or to capture a state of an application running the VM before an application upgrade or patch.

Azure VM Failed not start stay on Updating mode

I use azure vm, when vm is restart then failed to start vm error and stay on Updating mode, so I don't use azure recovery services.
Probably more of a server fault question.
Couple of things you can try:
Completely stop the VM to stopped(deallocated) status, then boot it backup, if you have problem stop it from portal, use powershell cmdlet
Re-size the VM, normally would move it to another host and can jump off the problematic host
Delete the VM retain disks, create another VM from the disk.
There is also a good chance all above would fail. If you have a RTO, you might want to start preparing failover/recreate the machine in parallel.
If someone is still experiencing the stuck in the UPDATING status, it's probably your VM's Disk ran out of space, what I did is I increased the size and it boot fine.

Is it possible to Capture running machine on Azure or it is recommended to shutdown before?

I have an Ubuntu 14 VM on Azure to host my developed web sites. (I do not think the OS matters in the point of view the question, but never know)
I've discovered the relatively new Capture button, so for the storage price of a disk size I regularly save a "snapshot" via the Capture function (I am not preparing the image for provisioning, I mean not checking the "I have run 'waagent -deprovision' on the virtual machine" checkbox). Be aware quickly becomes pretty addictive.
The result is an image what I can use when creating new machines, its there in My Images in the wizard. This can function as a backup/rollback worflow. If I delete the VM and create a new from one of resulting image of the previously captured "snapshots". (again, no provisioning will take place)
It is possible to initiate the Capture operation on a running VM. It is not clear for me, if the result will be an image what is a template for a new VM, and that VM will start up and boot, in what state the filesystem etc will be?
Is not it a similar state than sudden power lost? If yes, then it is strongly recommended to always shutdown the VM before capturing, however this such a pain and productivity killer, so no one (including me) wants to do unless it is mandatory.
Accidentally I've switched to the new Azure portal and there the Capture UI says:
Capturing a virtual machine while it's running isn't recommended.

Resources