{"id":1537,"date":"2019-12-08T10:50:43","date_gmt":"2019-12-08T16:50:43","guid":{"rendered":"https:\/\/www.ciraltos.com\/?p=1537"},"modified":"2023-03-23T22:38:39","modified_gmt":"2023-03-24T03:38:39","slug":"automatically-start-and-stop-wvd-vms-with-azure-automation","status":"publish","type":"post","link":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/","title":{"rendered":"Automatically Start and Stop WVD VM\u2019s with Azure Automation"},"content":{"rendered":"\n<figure class=\"wp-block-image alignleft\"><img decoding=\"async\" loading=\"lazy\" width=\"153\" height=\"154\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/04\/wvd.png\" alt=\"\" class=\"wp-image-1100\" srcset=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/04\/wvd.png 153w, https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2019\/04\/wvd-150x150.png 150w\" sizes=\"(max-width: 153px) 100vw, 153px\" \/><\/figure>\n\n\n\n<p>One value\nproposition of any cloud service is consumption-based pricing, only paying for\nservices when used.&nbsp; Consumption-based\npricing is an advantage of Windows Virtual Desktop (WVD), Microsoft Azure-hosted\nremote desktop service.&nbsp; Or at least it\nwould be if there was an easy way to start and stop session hosts based on\ndemand.<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container\" style=\"height: 100%;\"><iframe loading=\"lazy\" title=\"Automatically Start and Stop VM\u2019s in a Windows Virtual Desktop Host Pool with Azure Automation\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/EUpPY6ateKA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>Windows Virtual Desktop has a script referenced in the online documentation.&nbsp; It looks similar to a script used to start and stop on-premises RDS Session Hosts.&nbsp; I reviewed this script and, although it may fit some environments, there were elements that I didn\u2019t like about it.&nbsp; <\/p>\n\n\n\n<p>The first problem\nI ran into was the script&#8217;s complexity.&nbsp;\nIt has many options that make the script difficult to understand.&nbsp; The biggest issue for me, however, is that\nthe script had to run as a scheduled task on a server.&nbsp; This meant keeping an IaaS server running for\nthe script to work.&nbsp; That seemed like an unnecessary\nresource for a cloud service.&nbsp; <\/p>\n\n\n\n<p>With that in mind,\nI set out to write a script to save on WVD charges by shutting down Session\nHosts when they are not in use and start Session Hosts as demands increased.<\/p>\n\n\n\n<p>I began by\ndeveloping the script for Azure Functions.&nbsp;\nI quickly discovered that the WVD PowerShell module will not work with\nPowerShell 6 and had to move development to Azure Automation.&nbsp; I still use a function to trigger the Azure\nAutomation Runbook.&nbsp; More on that to come.<\/p>\n\n\n\n<p>The number of\noptions in this script is reduced to simplify it.&nbsp; The Microsoft Script provides options to use\na user account or a service principle, changes from depth-first to\nbreadth-first during peak hours and several other options.&nbsp; I did away with much of that while still\nproviding the stated functionality.&nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image alignright is-resized\"><a href=\"https:\/\/github.com\/tsrob50\/WVD-Public\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.ciraltos.com\/wp-content\/uploads\/2019\/10\/Octocat-150x150.png\" alt=\"\" class=\"wp-image-1454\" width=\"75\" height=\"75\"\/><\/a><\/figure>\n\n\n\n<p>Code for this project can be found on my GitHub site <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/github.com\/tsrob50\/WVD-Public\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<h2>Guidelines for Using the Script<\/h2>\n\n\n\n<p>Test it before you\ntrust it, this script is offered as-is with no warranty, expressed or implied. <\/p>\n\n\n\n<p>The script works with depth-first load balancing, during and outside peak hours.&nbsp; The goal is to save on cloud costs.&nbsp; The best way to do that is with depth-first load balancing.&nbsp; If you are not familiar with the load balancing options, see my video on the subject <a href=\"https:\/\/www.ciraltos.com\/azure-windows-virtual-desktop-load-balancing\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\">here<\/a>.<\/p>\n\n\n\n<p>Depth-first\nrequires a maximum number of sessions per session host.&nbsp; It is important to size the session hosts\ncorrectly for the workload and number of sessions on the Session Hosts to provide\na good user experience.<\/p>\n\n\n\n<p>This script only uses a Service Principle.&nbsp; There is no option for a user account.&nbsp; I have another video <a href=\"https:\/\/www.ciraltos.com\/azure-windows-virtual-desktop-service-principle-deployment\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here  (opens in a new tab)\">here <\/a>that goes over setting up a Service Principal for WVD.&nbsp; This is the Service Principal that the script uses to interact with WVD and start and stop session hosts.<\/p>\n\n\n\n<p>The script will\nonly work for one host pool.&nbsp; If you have\nmultiple host pools, configure a host pool for each.&nbsp; <\/p>\n\n\n\n<p>This script will\nnot provision new session hosts.&nbsp; It will\nonly start and stop existing servers based on the number of sessions to the\npool.&nbsp; Remember, there is little cost\nassociated with having servers at the ready and deallocated. <\/p>\n\n\n\n<p>The script won\u2019t\nfactor in servers set not to allow new connections.&nbsp; Servers with the host pool option\n-allownewsessions set to False will not be started or stopped.&nbsp; Any active connections on these servers will\nnot be factored into the logic to start or stop servers.<\/p>\n\n\n\n<p>The script will\nonly start or stop one server at each run.&nbsp;\n<\/p>\n\n\n\n<h2>Logic<\/h2>\n\n\n\n<p>The logic behind\nthe script is fairly easy.&nbsp; The basic\nfunctionality is to determine the number of session hosts that should be\nrunning and compare that to the number that is running.&nbsp; If there should be more running than there\nis, a session host will start.&nbsp; If there\nare more session hosts running than need to be, it will attempt to shut one\ndown.<\/p>\n\n\n\n<p>There are a couple\nof numbers that go into determining the number of servers that should be\nrunning.&nbsp; First is the number of active\nsessions.&nbsp; Find this by adding the number\nof active sessions from each session hosts.<\/p>\n\n\n\n<p>The next number is\nthe threshold value.&nbsp; The threshold value\nacts as a buffer to provide session capacity between script runs.&nbsp; If the number of available sessions falls\nbelow the threshold value, a new server will start.<\/p>\n\n\n\n<p>The last number is\nthe maximum number of connections per session hosts.&nbsp; The maximum connections are defined when\nconfiguring depth-first load balancing.&nbsp;&nbsp;&nbsp;\n<\/p>\n\n\n\n<p>The number of\nsession hosts that should be running is found by adding the number of active\nsessions and the threshold value, then dividing that sum by the maximum number\nof connections per session host.<\/p>\n\n\n\n<p>(Active Sessions +\nThreshold) \/ Max Connections<\/p>\n\n\n\n<p>It\u2019s not possible\n(yet) to start a fraction of a server, so any fraction is rounded up using the\nceiling function.<\/p>\n\n\n\n<p>For example, if\nthere are 24 active sessions in a host pool, and the threshold is 8, with 16\nmax sessions per session host, the total number of running servers is two.<\/p>\n\n\n\n<p>(24+8)\/16=2<\/p>\n\n\n\n<p>If one more user logs\nin, the number of required hosts is increased by one, and another session host\nis started:<\/p>\n\n\n\n<p>(25+8)\/16=3\n(rounded up to next whole number)<\/p>\n\n\n\n<p>After a while,\nseveral users log off.&nbsp; This brings the\ncurrently active users to 19 and the number of required servers back to two.<\/p>\n\n\n\n<p>(19+8)\/16=2<\/p>\n\n\n\n<p>The decrease in\nusers will trigger a server shutdown.&nbsp;\nThe script looks for a server with no active sessions.&nbsp; This is important because users don\u2019t log out\nin the same order they log in.&nbsp; There is the\npotential that all running servers have active connections.&nbsp; If the script finds a server without active\nconnections, it will shut that server down.<\/p>\n\n\n\n<h2>Peak Hours<\/h2>\n\n\n\n<p>A greater number\nof available session hosts are sometimes required to meet higher demand during peak\nuse time.&nbsp; The script defines a peak time\nrange and weekday.&nbsp; The threshold can be\nadjusted to accommodate a higher demand during that time.&nbsp; Increasing the threshold value will create\nmore available sessions between script run.&nbsp;\n<\/p>\n\n\n\n<p>Extending our\nprevious example, if the requirement is to have one server worth of sessions available\nduring peak hours, set the threshold to 17 (max sessions + 1).&nbsp; That will keep an extra server running to accommodate\nlogins during active periods.<\/p>\n\n\n\n<h2>Deployment<\/h2>\n\n\n\n<p>The items listed\nin this section is an overview of the prerequisites and process of deploying\nthe script.&nbsp; See my video for a walkthrough\nof the full setup.<\/p>\n\n\n\n<h3>Group Policy<\/h3>\n\n\n\n<p>There is no way to\nlog out disconnected or idle sessions in WVD.&nbsp;\nBy default, disconnected and idle sessions will exist indefinitely, preventing\nservers from shutting down.&nbsp; Set limits\non idle and disconnected sessions with a Group Policy Object (GPO).&nbsp; Create a GPO and modify the settings under\nComputer Configuration &gt; Policies &gt; Administrative Templates &gt; Windows\nComponents &gt; Remote Desktop Services &gt; Remote Desktop Session Hosts &gt;\nSession Time Limits.&nbsp; Enable and set the\nlimit for disconnected sessions and limit for active but idle RDS sessions. Exact\nlimits vary by environment. <\/p>\n\n\n\n<p>Apply this GPO to\nthe session host OU in Active directory once created.<\/p>\n\n\n\n<h3>Azure Automation<\/h3>\n\n\n\n<p>This script requires an Azure Automation account.&nbsp; These are easy to set up, and cost is minimal to run.&nbsp; Find more information on setting up an Azure Automation account at my playlist <a href=\"https:\/\/www.youtube.com\/playlist?list=PLnWpsLZNgHzUlRBMDKr-svz32frt3x_tC\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\">here<\/a>.<\/p>\n\n\n\n<p>The script uses the\nAz PowerShell Module and the WVD PowerShell Module.&nbsp; Newly deployed Azure Automation accounts have\nthe AzureRM module installed by default.&nbsp;\nAll three of the modules below are required for the script and need to\nbe added to the Azure Automation account.<\/p>\n\n\n\n<p>Az.Accounts<br>Az.Compute<br>Microsoft.RDInfra.RDPowershell<\/p>\n\n\n\n<h3>Service Principle<\/h3>\n\n\n\n<p>The service\nprinciple is used to retrieve session and host information from WVD.&nbsp; It is also used to log into Azure and run the\nstop or start command.&nbsp; There are two\nsteps to make this work.<\/p>\n\n\n\n<p>First, add a credentials\nobject to Azure Automation using the Application ID and Password of the Service\nPrinciple used to deploy WVD.&nbsp; The\npassword was captured during set up.&nbsp; If\nnot, create a new one from the App Registrations properties for the object in\nAzure AD.<\/p>\n\n\n\n<p>Second, the\nService Principle must have Contributor rights to the Session Host Resource\nGroup.&nbsp; The same service principle is\nused to log into Azure and interact with the session hosts.&nbsp; It needs Contributor RBAC rights to the\nresource group to start and stop with the VM\u2019s.<\/p>\n\n\n\n<h3>Azure Function<\/h3>\n\n\n\n<p>Using Azure\nFunctions is my least favorite part of this solution.&nbsp; The script should run every 5 minutes.&nbsp; The minimum reoccurrence for schedule in\nAzure Automation is 1 hour.&nbsp; That is not\nshort enough to be effective.&nbsp; Azure\nFunctions can run every 5 minutes and trigger the webhook. This webhook starts\nthe Azure Automation Runbook.&nbsp; <\/p>\n\n\n\n<p>Start by\npublishing the Azure Automation runbook and going to Add Webhook.&nbsp; Create and save the Webhook.&nbsp; You will not be able to retrieve the once the\ncreation window closes.<\/p>\n\n\n\n<p>Create a new\nconsumption-based PowerShell Azure Function App.&nbsp; Add a new time-based trigger int the Azure\nFunction app.&nbsp; Use the following schedule\nto run the function app every 5 minutes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"0 *\/5 * * * *\"<\/pre>\n\n\n\n<p>Go to the Run.PS1\nscript and removing everything but the parameter section of the script.&nbsp; Add the line below to trigger the\nwebhook.&nbsp; <\/p>\n\n\n\n<p>Invoke-WebRequest\n-Uri &lt;Webhook URI&gt; -Method Post<\/p>\n\n\n\n<h2>Costs to Run<\/h2>\n\n\n\n<p>The cost of this\nsolution is dependent on factors including time between each run, region, and\nruntime of the script.&nbsp; The costs listed\nbelow are a demonstration only and not intended for actual pricing.<\/p>\n\n\n\n<p>Azure Automation running for one minute, every 5 minutes each month.<\/p>\n\n\n\n<p>12 times per hour\n* 24 hours * 30 days = 8640 minutes a month. &nbsp;<\/p>\n\n\n\n<p>Azure Runtime\nprice = $0.002\/minute<\/p>\n\n\n\n<p>$17.28 per\nmonth.&nbsp; <\/p>\n\n\n\n<p>An Azure\nConsumption-Based Function provides 1 million free executions per month.&nbsp; The Azure Function should not exceed the free\nallotment.<\/p>\n\n\n\n<h2>Summary<\/h2>\n\n\n\n<p>This script accomplished\nmy goal of starting and stopping servers based on user load.&nbsp; Please note that testing took place in a\nsmall environment of 3 servers.&nbsp; Although\nthe size of the environment should not matter, there may be some unexpected\nresults in large environment.&nbsp; <\/p>\n\n\n\n<p>Logging and\nalerting could be enhanced in this script.&nbsp;\nFor example, I posted information here on sending alerts to a Teams\nchannel.&nbsp; There is another post here on\nusing Send Grid to send alerts from PowerShell. &nbsp;Either one could be used to send notifications\nwhen the script makes a change.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One value proposition of any cloud service is consumption-based pricing, only paying for services when used.&nbsp; Consumption-based pricing is an advantage of Windows Virtual Desktop (WVD), Microsoft Azure-hosted remote desktop service.&nbsp; Or at least it would be if there was an easy way to start and stop session hosts based on demand.<\/p>\n","protected":false},"author":1,"featured_media":3808,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[2,391],"tags":[608,610,611,617,230,9,581,210,614,408,602,604,399,207,616,605,603,406,409,206,606,607,11,401,412,609,181,410,411,52,394,612,613,618,615,222,407,405,398,400,404,392,393],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Automatically Start and Stop WVD VM\u2019s with Azure Automation - ciraltos<\/title>\n<meta name=\"description\" content=\"IThis script saves on Windows Virtual Desktop charges by shutting down Session Hosts when they are not in use and start Session Hosts as demands increased.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automatically Start and Stop WVD VM\u2019s with Azure Automation - ciraltos\" \/>\n<meta property=\"og:description\" content=\"IThis script saves on Windows Virtual Desktop charges by shutting down Session Hosts when they are not in use and start Session Hosts as demands increased.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\" \/>\n<meta property=\"og:site_name\" content=\"ciraltos\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-08T16:50:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-24T03:38:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/10\/wvd-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"153\" \/>\n\t<meta property=\"og:image:height\" content=\"154\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Travis Roberts\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:site\" content=\"@ciraltos\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Travis Roberts\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\"},\"author\":{\"name\":\"Travis Roberts\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"headline\":\"Automatically Start and Stop WVD VM\u2019s with Azure Automation\",\"datePublished\":\"2019-12-08T16:50:43+00:00\",\"dateModified\":\"2023-03-24T03:38:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\"},\"wordCount\":1810,\"commentCount\":17,\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"keywords\":[\"Application Assignment\",\"Application Groups\",\"Applications\",\"automatically start\",\"Automation\",\"Azure\",\"Azure AD Application\",\"Azure Automation\",\"azure function\",\"Azure Gallery\",\"Breadth\",\"Breadth First\",\"Citrix\",\"Connection Broker\",\"cost saving\",\"Depth\",\"Depth-First\",\"Desktop\",\"Gateway\",\"Load Balancing\",\"Maximum connections\",\"maximumallowedconnections\",\"Microsoft\",\"multi user\",\"persistent desktops\",\"published apps\",\"RDS\",\"RDWeb\",\"remote access\",\"remote desktop\",\"Remote Desktop Services\",\"Service Principal\",\"start\",\"start and stop\",\"stop\",\"tutorial\",\"VDI\",\"virtualize\",\"walkthrough\",\"Windows 10\",\"Windows 7\",\"Windows Virtual Desktop\",\"WVD\"],\"articleSection\":[\"Azure\",\"Windows Virtual Desktop\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\",\"name\":\"Automatically Start and Stop WVD VM\u2019s with Azure Automation - ciraltos\",\"isPartOf\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\"},\"datePublished\":\"2019-12-08T16:50:43+00:00\",\"dateModified\":\"2023-03-24T03:38:39+00:00\",\"description\":\"IThis script saves on Windows Virtual Desktop charges by shutting down Session Hosts when they are not in use and start Session Hosts as demands increased.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.ciraltos.com\/staging2\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automatically Start and Stop WVD VM\u2019s with Azure Automation\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#website\",\"url\":\"http:\/\/www.ciraltos.com\/staging2\/\",\"name\":\"ciraltos\",\"description\":\"cloud, technology and trends\",\"publisher\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a\",\"name\":\"Travis Roberts\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"contentUrl\":\"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png\",\"width\":5657,\"height\":3563,\"caption\":\"Travis Roberts\"},\"logo\":{\"@id\":\"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/www.ciraltos.com\",\"https:\/\/twitter.com\/ciraltos\"],\"url\":\"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automatically Start and Stop WVD VM\u2019s with Azure Automation - ciraltos","description":"IThis script saves on Windows Virtual Desktop charges by shutting down Session Hosts when they are not in use and start Session Hosts as demands increased.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/","og_locale":"en_US","og_type":"article","og_title":"Automatically Start and Stop WVD VM\u2019s with Azure Automation - ciraltos","og_description":"IThis script saves on Windows Virtual Desktop charges by shutting down Session Hosts when they are not in use and start Session Hosts as demands increased.","og_url":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/","og_site_name":"ciraltos","article_published_time":"2019-12-08T16:50:43+00:00","article_modified_time":"2023-03-24T03:38:39+00:00","og_image":[{"width":153,"height":154,"url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2021\/10\/wvd-1.png","type":"image\/png"}],"author":"Travis Roberts","twitter_card":"summary_large_image","twitter_creator":"@ciraltos","twitter_site":"@ciraltos","twitter_misc":{"Written by":"Travis Roberts","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#article","isPartOf":{"@id":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/"},"author":{"name":"Travis Roberts","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"headline":"Automatically Start and Stop WVD VM\u2019s with Azure Automation","datePublished":"2019-12-08T16:50:43+00:00","dateModified":"2023-03-24T03:38:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/"},"wordCount":1810,"commentCount":17,"publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"keywords":["Application Assignment","Application Groups","Applications","automatically start","Automation","Azure","Azure AD Application","Azure Automation","azure function","Azure Gallery","Breadth","Breadth First","Citrix","Connection Broker","cost saving","Depth","Depth-First","Desktop","Gateway","Load Balancing","Maximum connections","maximumallowedconnections","Microsoft","multi user","persistent desktops","published apps","RDS","RDWeb","remote access","remote desktop","Remote Desktop Services","Service Principal","start","start and stop","stop","tutorial","VDI","virtualize","walkthrough","Windows 10","Windows 7","Windows Virtual Desktop","WVD"],"articleSection":["Azure","Windows Virtual Desktop"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/","url":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/","name":"Automatically Start and Stop WVD VM\u2019s with Azure Automation - ciraltos","isPartOf":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#website"},"datePublished":"2019-12-08T16:50:43+00:00","dateModified":"2023-03-24T03:38:39+00:00","description":"IThis script saves on Windows Virtual Desktop charges by shutting down Session Hosts when they are not in use and start Session Hosts as demands increased.","breadcrumb":{"@id":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ciraltos.com\/staging2\/automatically-start-and-stop-wvd-vms-with-azure-automation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.ciraltos.com\/staging2\/"},{"@type":"ListItem","position":2,"name":"Automatically Start and Stop WVD VM\u2019s with Azure Automation"}]},{"@type":"WebSite","@id":"http:\/\/www.ciraltos.com\/staging2\/#website","url":"http:\/\/www.ciraltos.com\/staging2\/","name":"ciraltos","description":"cloud, technology and trends","publisher":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ciraltos.com\/staging2\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/25391996d6cddfecd4d257162b7e373a","name":"Travis Roberts","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/","url":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","contentUrl":"https:\/\/www.ciraltos.com\/staging2\/wp-content\/uploads\/2023\/03\/Logo-1.png","width":5657,"height":3563,"caption":"Travis Roberts"},"logo":{"@id":"http:\/\/www.ciraltos.com\/staging2\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/www.ciraltos.com","https:\/\/twitter.com\/ciraltos"],"url":"https:\/\/www.ciraltos.com\/staging2\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1537"}],"collection":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/comments?post=1537"}],"version-history":[{"count":8,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1537\/revisions"}],"predecessor-version":[{"id":3971,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/posts\/1537\/revisions\/3971"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media\/3808"}],"wp:attachment":[{"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/media?parent=1537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/categories?post=1537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ciraltos.com\/staging2\/wp-json\/wp\/v2\/tags?post=1537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}