Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
To make the most efficient use of Public cloud you need to ensure your servers are only running when they need to be.
Using SharePoint online as the source of virtual machine start-up and shutdown schedules is an option that allows for an easy, consolidated view of all your VMs and their schedules plus allows for the granular allocation of permissions for your staff, without having to grant them any Azure fabric access.
I'm going to assume some familiarity with SharePoint Online custom lists and Azure Automation principles for this blog post.
If you need some help getting started with these, try the following links.
How to create a Custom List in SharePoint Online Getting Started with Azure Automation
To integrate SharePoint Online with Azure Automation (and Powershell scripts), I've used a fantastic module written by Tao Yang, SharepointSDK.
The details can be found here.
To get set up for using SharePoint Online and Azure Automation, please refer to my Blog post here --> https://blogs.msdn.microsoft.com/jrt/2017/04/07/setting-it-up-sharepoint-online-lists-with-azure-automation/
Create the SharePoint Custom list for your VMS
The columns you'll need are
Note: To create the list of available Timezones I used the following snippet of Powershell script -
ForEach ($TZ in ([System.TimeZoneInfo]::GetSystemTimeZones())) { Write-Output "$($TZ.DisplayName) [$($TZ.Id)]"}
(Optional) Create the SharePoint Custom list for logging Automation Actions.
The columns you'll need are
Create a script or Azure Automation runbook to populate the SharePoint List with your VMs
The best way to populate your SharePoint list is to either run a Powershell script or create an Azure Automation Runbook to do that.
I've posted a script to do this here --> Load Azure VMs into a SharePoint Online List
and an Automation Runbook that can be imported here --> Load Azure VMs into a SharePoint Online List - Automation Runbook
Alternatively you can just enter the required Virtual Machine details directly into the SharePoint List.
Download Link from TechNet.
The most complex piece to this is the TimeZone adjustments.
Azure Automation runs on UTC time so you need to make sure when you specify to shutdown a VM at 6pm on a Friday, you don't end up shutting down your VM at 8am on Friday, which is what happens using AST (Sydney, Australia) time!
I got myself lost when trying to make a small change that I had to stop all code development and actually write a Flow Chart of how script works.
I strongly suggest if you are trying to work out how this script does what it does, that you work with this Flowchart open alongside.
AutoShutdown-Flowchart (Note: Please ping me if you want the Visio version of this to update any changes of your own)
Please sign in to use this experience.
Sign in