Does Azure deallocate end user's VM's at its own discretion?
I was using an Azure VM for a clean build and then the remote connection was dropped, I tried to reconnect by RDP and found out the machine was deallocated.
The info from Microsoft was:
Connect is disabled because this virtual machine is deallocated.
I did not know that Azure took machines away like that?
I would be hesitant to use Azure VM's in the future for build work.
Azure does not de-allocate your VM. There are numerous reasons you VM might be de-allocated while you are using it, below are a few;
Like #david mentioned in comment, you ran out of credit
Shared subscription, someone that also has access to you subscription shutdown VM
Automation, VM is set to shutdown at a certain time
These a just a few reason why you vm might have de-allocated while you are using it. If you can't determine on your own why it shutdown you can file a support ticket with Azure support.
Hope this helps.
Check if your appropriate resource group is enabled:
Open Azure portal.
Navigate to the Subscriptions.
Search for the necessary subscription group. enable it.
By default, there is a scheduled shutdown on Azure. If you go to operations settings in the left panel of the Azure VM portal, there is an auto-shutdown. You need to disable it so that your VM won't shutdown at the scheduled time.
Azure VM machine might be in stopped mode so it is saying that error message, please check the Azure VM list and see the status, accordingly start the VM, it will work
normally when you create your VM, you will see that there is a parameter that it will stop at 7pm or something like that. So After 7pm it will stop you VM. Which is good I think, because we tend to forget our VMs and then we pay for nothing. So no worries, just start your vm and you are all good to go :)
Related
Background:
Now I use an Azure Automation to shutdown the Azure Vms,
but I met a problem last time when one VM had been shutdown form the Azure portal
when it was restarting after the applied patch and the result was the VM could not start again.
I want to find if there has a script that can check if the VM is restart/start/shutdown when I shut down the VM from Azure Portal.
Thanks in ad
You can use Azure Automation to schedule all your Start/Stop/Restart jobs. If ever, you need to check when and how your VMs have been restarted and by whom, you could check the Log history from the portal, inside your VM's sections. To automate the display of this using a script, you could use a simple runbook that queries the tables from the access logs of your VM, and triggers an action of your choice...
I hope this could help you resolve your issue :)
We have a Virtual Machine which scheduled to stop automatically on every end of the day.
Next day when we want to connect to it, we need to explicitly login to Azure portal, select Virtual machine and click on start.
I know we can schedule it using automation account (due to some restrictions in office environment cant use automation account) but is there any way we can achieve this?
Thinking of any way of -
Creating a batch file on my local machine which just start the VM
when I run it without logging into Azure portal?
Any other simple setting like we have to schedule auto stop?
Any other hint will be a great help.
Thank you!
you can just use az cli and\or powershell and script the vm to start, its extremely straight forward (something like az vm start -g rg_name -n vm_name).
There are no built-in startup solutions yet.
I use Azure- windows VM for running some services, the services are very stable(after testing).
The server run one day and after that he has fallen and i get this message.
**
Diagnose and solve problems
In Activity log
Resource health
Solved
The problem was in 'Auto-shutdown' it was enabled to 'Scheduled shutdown'. you can find it under - HOME --> VM --> Auto-shutdown(under the title Operations).
From the Activity Log, we can see the Azure Lab Service initiated the VM deallocation.
When you create a Lab Service in Azure, there is an option for you to automatically shut down virtual machines when users disconnect. It's probably the reason. This could help save costs.
It's the same Lab policy when you create template VMs in the lab Account or change it later.
Is there a way to run bash script on a VM before it's deleted from Azure? I know you can use CustomScriptExtension for running script when VM is created or started but I couldn't find any information about launching cleanup scripts before VM is deleted.
No, at the time of writing Azure does not support actions like this.
Depending on what you want to do, you may find it useful to subscribe to VM alerts, which can include when it is deleted. You'll have the option to call a webhook that may give you the flexibility to do what you need. Try working within the Azure portal Monitoring Blade to create your own Alert to handle this.
I have a program that I run only 1-2 hours a day. Is there a way to suspend the Azure server so I don't pay for it, then resume it later? How fast is it to suspend and then resume?
To clarify here, Azure no longer charges for stopped VMs. The billing change was announced in 2013 on Scott Guthrie's blog: No Charge for Stopped VMs.
This means you can use the portal or APIs to stop a VM without deallocating the resource - and avoid charges at the same time.
Not sure if you are asking for Window Azure Cloud Services or for Windows Azure Virtual Machines but you sure can stop/start these Azure Virtual Machines directly on Windows Portal or using Powershell or REST based Service Management API. The Windows Azure Portal does not provide a way to schedule stop/restart so you will have to manually do it by yourself or use some 3rd party service i.e. AzureWatch etc to do it.
Note: Even if you shutdown the Virtual Machine or Cloud Service, you will still pay for if you want to do it for cost saving, then you would need to delete the service or VM. Reboot/Restart does not take long as VM is already configured and ready to run so it is just the time to turn on a pre-configured VM.
If you want to use REST API in your own application to stop/start here is some help:
Virtual Machines: http://msdn.microsoft.com/en-us/library/windowsazure/jj157206.aspx
Cloud Service: http://msdn.microsoft.com/en-us/library/windowsazure/gg441298.aspx
If you want to use Powershell to stop/Start Azure VM look for "Start-AzureVM" and "Stop-AzureVM" cmdlet below:
http://msdn.microsoft.com/en-us/library/windowsazure/jj152841.aspx
To save money, I did Remote Desktop to my Azure Windows VM, and clicked shutdown.
Then, at my Azure dashboard (https://manage.windowsazure.com) > VIRTUAL MACHINES > STATUS it changed from Running to Stopped.
But then I read this doesn't stop the billing.
So I went to Microsoft Azure > Virtual machines (classic) >
and saw the status was Stopped. But this doesn't mean billing stopped.
I clicked the "stop" command, and it changed to Stopped (deallocated) which means no (or near 0) billing.
The screenshot says it all... so only a "deallocated" VM won't be billed!
One more thing to add. As opposed to a deleted VM, a deallocated VM still has virtual disks attached to it which consume storage space and therefor creates costs.
If you mean the "suspended" state you can achieve with your computer I don't think is available today on Azure.
Google Cloud for example has just released that feature on beta https://cloud.google.com/compute/docs/instances/suspending-an-instance