VM deployment from custom image stuck in 'Create' state - azure

I logged into an existing VM, did sysprep, selected generalize + oobe, shutdown, waited for deallocation, then captured from the portal.
I created an image from the generalized disk in the Azure portal, but when it tries to start, it gets stuck in the Create state. Looking at the boot diagnostics, it appears it's asking for language, keyboard layout, etc. It is of course not possible to RDP into the machine in this state. Is there something I can add to the deployment template / automation script to get past this?

Related

What results to examine before "Commit" while migrating Azure VM Classic to ARM

I'm planning to migrate an Azure VM Classic to ARM.
In the "Migrate to ARM" page on Azure Portal, i have passed the (1) validation and then completed the (2) Prepare step without problems. Now the page has two green checks and says:
Prepare operation completed.
Your resources will be migrated to the following resource group(s). You may wish to examine them to ensure the results are as expected.
The question is how to examine the results? What results to examine?
Does it mean the contents of VM? At the prepare step the VM stopped as i expected. How can i test the web applications or files inside VM while it is closed?
Are there any other checks i should do after successful Prepare and before Commit?
The VM concerns production server and we must guarantee its health and quick return to uptime before pressing "yes" and "Commit".
The error indicates that you might want to double check if all the resources showing ready for the move are the ones that you expect to migrate to desired resource group for the conversion of classic to ARM.
Saying examine them means review the selected resources
Message: Your resources will be migrated to the following resource group(s). You may wish to examine them to ensure the results are as expected.
How can i test the web applications or files inside VM while it is closed?
You'll have to ensure the web application is working before starting the migration. Ensure all files are intact.
You'll not be able to test it while the VM is off.
Are there any other checks i should do after successful Prepare and before Commit?
None, you can commit as long as there are specific validation errors.
I would recommend going through the Technical deep dive on platform-supported migration from classic to Azure Resource Manager
Wishing GoodLuck with the migration!

Application deployment for cloud

I am new to cloud platform.
I know that various cloud vendor have a mechanism wherein if the VM crashes and cannot be brought up, it can spin a new VM
In such a case, how is the code deployed on the new VM that the Cloud provider spins?
In such a case does the application owner has to deal with the deployment or is it taken care of by the Provider
For PaaS, you upload a package and configuration (cspkg and cscfg from your build) to the cloud service, this is deployed by Azure automatically, you can specify how many (and size) machines you want your application to be deployed over, and it's configurable via the Portal (and outside using PowerShell/REST) if you want to.
In your solution you specify the size in the csdef:
<ServiceDefinition name="MyWebRole.CloudService"
<WebRole name="MyWebRole" vmsize="Small">
And the number of instances in the cscfg:
<Role name="MyWebRole" vmName="WebRole">
<Instances count="2" />
You should make sure you have a minimum of 2 instances running for your app, if one goes down then your app won't fail straight away. Microsoft may need to tear it down or update it without telling you (and you shouldn't notice apart from any logs etc), if your app cannot cope on a single instance then make sure you have 3 (so in the event of a server going down you still have a minimum of 2).
Via the Azure Portal you can both reboot and reimage (deploy your package/config to a completely new machine), the package/config are retained in Azure so you don't need to deploy them again, the same thing happens when you scale your service up/down, the package/config already exist in Azure so it "just does it" (expecting a busy day? Add some machines to your service, or set it to auto scale based on a metric).
IaaS is very much the same as your usual VM scenario, you spin them up, remote onto them and do whatever is necessary! You can turn them on and off via the portal. Installations, OS issues/config, patching, are your own problems (potentially joined to a domain so policies/DSC can be used if that's what your familiar with), so if you have something that needs to be installed via an exe etc or used with a GUI, then VM's work for this scenario. As a side note, I've only every once seen an issue in Azure with a VM getting knackered (blue screen -> insert cd error), if you think you have a problem with the platform you can do things like delete the VM (but keep the disks!) and create a new one with the same disks.
Another thing to look into is WebApps/AppServices, they are kind of like Cloud Services, except they take away some of the issues such as having actual underlying VMs.

How do you create an Azure virtual machine that looses state on disconnect?

I would like to create a virtual machine in Azure that is automatically reset to the just-deployed state after a user disconnects. I can probably do this through creating a backup image and doing a restore after the user logs out with Save-AzureVMImage, but I am wondering if there is any way to set the machine to not save state at all, as used to be the default case in old virtual machines. The reset state must include the state of the OS, not just applications, so it is bit-for-bit identical (or as practically close as possible) to an initial deployment. Right now I am re-deploying a new VM manually to achieve this goal.
Is there a way to configure a VM to behave like I want?
If not, is there a way to automate the restore process after a user logs out of the VM?
There's no such feature, but shouldn't be hard to develop something like this using Automation. The first DevOps logic I could think of is:
Create a VM image
Create a Powershell script to destroy the old and deploy a new VM from this image
Create an Automation account and create a runbook with this script
Use Webhook to trigger the runbook
Create a Powershell script to verify if no users are logged in (may need more logic in here)
Improve this script to make an HTTP POST to trigger the runbook
Assign User Logoff Script
Probably you could skip step 5 tho and step 2 actually needs to be done after step 7 because you need the script configured in the VM before snapshot.

What hooks can I use to detect a VM Shutdown event with Azure IaaS?

I'm working on an automation tool whereby I need to trap events that are occurring within an Azure subscription.
Taking an Azure VM as an example - how can I trap a shutdown event for a single VM so that for example, a web service is called?
Azure Scheduled Events (in Preview at time of post) is your best bet. This is built upon the Azure Instance Metadata Service (also in Preview at time of post) which surfaces historic and up-coming information from within the VM, allowing you to proactively react to events.
To my knowledge, there's no way to monitor for events such as this from outside the VM, however this article provides some great code examples which could be run from within the VM that you could use to trigger an alert/action outside the VM if you needed to.

Azure Virtual machine is stuck at "starting"

I'm testing Azure using my MSDN account.
All went well, until I went over my spending limit, after which my services were suspended.
After my account was re-enabled, I wanted to start my Virtual Machines again.
However they keep having status 'Starting'.
The user-interface of the Azure management portal seems to offer no methods to remedy this situation.
Any ideas on how to reset these servers, or find a way to determine what is keeping them from finishing the starting process?
do not delete it, you can use azure powershell to stop it and start it again. the keep disks lost one of vhd's when we tried to do it that way.
I am experiencing the same issues and don't know the cause, but you temporarily fix it by deleting the Virtual Machine - you will get the option to delete or keep the associated disks - KEEP THEM.
After about 10-15 minutes, the disks will appear in the My Disks part of the Create Virtual Machine gallery - allowing you to re-create the machine with the same disks. You can also reuse the same name etc.

Resources