Azure Scheduled VM - azure

This is essentially a question about saving money - we have build machines in azure - but they are only active for about 8 hours a day. Is there any easy way to create a schedule, so they are taken off line for the rest of the time, so we only pay for 1/3 the amount of compute time?

Darren
Yes , its possible. There are two options available
Via Powershell
http://gallery.technet.microsoft.com/scriptcenter/Start-Windows-Azure-b6c179b6
Using Azure VM As scheduler.
http://clemmblog.azurewebsites.net/start-stop-windows-azure-vms-according-time-schedule/

The thing that you can do is using a Powershell script to start/stop the VMs at certain times.
You can find a draft at the Azure Management Portal, under Automation ==> Runbooks.
There you can also find runbooks to scale your machines over the night, to cut costs ever more.
I hope this helps :)

Related

Downgrading Azure Resources during weekends using PowerShell Automation

In order to save expenses in Azure DevOps, I'm trying to scale the resources, which can scale depending on the requirement. Team leads will update the resource requirements in SharePoint, and the runbook needs to be executed with SharePoint datat. Team leads will update the resource requirements in SharePoint, and the runbook needs to be executed with SharePoint data. If such resources are not required on weekends but must be operational on weekdays, they should be stopped or reduced in size. I need to use automation to do it for all of the VMs and App Services at a subscription level every Friday. If there is a method to automate this procedure using PowerShell.
I'm glad to receive input. Thanks in advance.
I'm looking for feedback on Start/Stop VMs and Scaling Azure App Services. On weekends, the same may be said for other relevant resources. How can we accomplish this with Azure PowerShell?
 
The best way to do is by using 'Azure Automation Runbook' scheduled to run every specified day or date by time. To target the VM's, Azure Tags will be much helpful.
Your script must check:
A VM has a specific Tags (e.g., StopVM:Friday 11:00PM)
Maintenance Enabled in your monitoring solution
VM is stopped already or not.
Backup required?
Confirm the VM is Deallocated (not stopped)
Auto-Shutdown option is also available to do this activity.
Because sometime all you need is a quick and dirty way to save money :
And if you wan't to build something there's an API to shutdown and start VMs

Vertical auto-scaling Azure VM

Recently, i have been introduced to Azure and i have an application that is using high CPU (almost 80%) during morning hours between 9 am to 1 pm. After that the CPU utilization is reduced to a minimal of 10% the whole day. So in order to reduce my cost i was thinking to implement vertical auto-scaling in my application. When i read more on this i could find automation account and RunBook as the only way but my need is that is there any other way to implement Vertical auto-scaling in Azure IaaS VM apart from automation account?
If Yes, please share the approach.
Yes you can use Azure PowerShell and/or the Azure CLI to execute scaling commands on a VM. Here are some PowerShell examples: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/resize-vm?toc=%2Fazure%2Fvirtual-machines%2Fwindows%2Ftoc.json
You would then just have to schedule the script to run either locally or in an Azure service like Functions, Container Instances or etc.
If you wanted to scale vertically a single VM based on a performance metric (CPU, memory, etc.) you can use the classic metric alerts system to do that. When those alerts fire based on thresholds you set you can invoke a webhook OR Logic App to trigger execution of a script or ARM Template.

Best practices for reducing Azure VM hours?

I recently implemented SSRS on a Azure VM and was very surprised when I realized I would be billed for 100% of the hours in a month if my VM was running. This runs around $200 and is in no way economical for our small reporting service we use for about 5 days month. What are my options for reducing VM hours?
I have already established I can shutdown and deallocated the machine when we are not using it. Ideally though the service would go into some kind of sleep mode and reallocate when the service is pinged.
You pretty much figured it out: When a VM is running, you're billed for it. This is how it's always been in Azure: Whether utilizing 0% or 100% of the VM, you're billed for the running VM. Think of it as paying for reserved resources. Just like an apartment, where you pay for the rent even if you're using it 0% (e.g. not home).
You can choose to stop the VM at any time, and billing stops, until you start the VM again. This is easily done via PowerShell / CLI, so you can automate it with your own tooling.
Note that VM billing is actually per minute, so if you shut down a VM after 30 minutes, you're not billed for an entire hour.
Only you can decide the proper way to manage your VM's uptime, based on your app's usage. There's no single right answer to that. And there's no mechanism for the VM to sleep if it detects inactivity. That's going to be an application-dependent thing (deciding when to shut down).
You have a couple of options to correct address this:
You could use automation, where you run a Powershell script to turn you VM off during off-peak time. Check this out:http://azure.microsoft.com/blog/2014/08/20/azure-automation-capabilities-in-depth-the-azure-automation-powershell-cmdlets/
You can setup alerts now in your account portal (yeah, I just said that!) Check it out here: http://azure.microsoft.com/en-us/documentation/articles/azure-billing-set-up-alerts/
I would look at both. You can shut-down a VM from PowerShell (MS just demonstrated that to me in a workshop this week), so I would use this approach if you know that SSRS is only going to run for a specified window.
You can also check Azure automation option if you have a definite schedule for the VM to be up and down. Azure automation gives you a way to create a runbook to manage the up time of the VM and also options to do the scheduling. Check this blog for more information https://blogs.endjin.com/2015/01/using-azure-automation-to-run-vms-during-office-hours-only/

PiCloud-like service on Azure?

I'm looking for an execution environment on Windows Azure that is similar to PiCloud:
queued jobs
CPU charged in small increments (1ms in case of PiCloud)
Does anyone know of such a service?
Not off hand. Windows Azure is more like Amazon in that you get a dedicated VM with per hour pricing. I don't believe anyone has yet created a multi-tenant job processing framework on it with he ability to bill-back the time spent working on client jobs.
Sound like an interesting idea for a start-up though. :)

How can I set up a CRON job using Windows Azure?

Is there a way to use the windows scheduled task to kick off a url or a exe on a schedule?
Can I write a program as an exe then create a Azure VM then RDP into the Azure VM and hook it up to windows task scheduler?
Azure does have a scheduler now.
It allows invoking a Web Service over HTTP/s and post a message to a Windows Azure Storage Queue. It's very new but it can be free if you do not need the scheduler to be executed often. Otherwise it's a small monthly fee which come with scheduled task that can be up to every minute.
Things got much easier lately, please see this link https://azure.microsoft.com/en-us/services/scheduler/ to create a scheduled job in the new Azure Scheduler. There is a basic Free tier as well as some paid options but I think this is exactly what many of us were looking for. It is an excellent solution for triggering URLs with GET,POST,PUT,DELETE requests.
Just follow the simple instructions. Starting by selecting "Scheduler" from the Azure dashboard app menu:
Today the scheduler has been Azure Logic Apps:
https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-overview
If you are looking for something like a cron job (which is a job, that is being run at specific time again and again), then check out Azure Functions:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-overview
Google Azure Storage Queues. They allow you to schedule jobs that will run at a later date. You can even specify when the job should run.

Resources