{"id":11968,"date":"2022-05-13T11:48:34","date_gmt":"2022-05-13T11:48:34","guid":{"rendered":"https:\/\/blog.cloudthat.com\/?p=11968"},"modified":"2024-06-25T11:00:49","modified_gmt":"2024-06-25T11:00:49","slug":"manage-azure-resources-efficiently-virtual-machine-automation","status":"publish","type":"blog","link":"https:\/\/www.cloudthat.com\/resources\/blog\/manage-your-azure-resources-efficiently-with-virtual-machine-automation","title":{"rendered":"Manage Your Azure Resources Efficiently With Virtual Machine Automation"},"content":{"rendered":"<table style=\"height: 203px;\" border=\"3\" width=\"351\">\n<tbody>\n<tr>\n<td>\n<h2><span style=\"color: #000080;\"><strong>TABLE OF CONTENT<\/strong><\/span><\/h2>\n<\/td>\n<\/tr>\n<tr>\n<td><a href=\"#introduction\">1. Introduction<\/a><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#prerequisites\">2. Prerequisites<\/a><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#configuring\">3. Configuring Log Analytics Workspace<\/a><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#conclusion\">4. Conclusion <\/a><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#aboutcloudthat\">5. About CloudThat <\/a><\/td>\n<\/tr>\n<tr>\n<td><a href=\"#faqs\">6. FAQs<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"introduction\">1. Introduction<\/h2>\n<p>Cost management is an integral part of managing Azure resources, and you can see that under the billing section major portion is covered by Virtual Machines. You can create automated management tasks for a specific resource or resource group by automation task templates, which vary in availability based on the resource type. So, in some cases, you can stop the VMs at specific schedules to save the operations cost of VMs. In this blog, you will get to know how to Start and Stop the VMs on-off office hours and even on weekends and manage your Azure Resources efficiently.<\/p>\n<h2 id=\"prerequisites\">2. Prerequisites<\/h2>\n<ul>\n<li>Azure Subscription<\/li>\n<li>Virtual Network<\/li>\n<li>Virtual Machine<\/li>\n<\/ul>\n<h2 id=\"configuring\">3. Configuring Log Analytics Workspace<\/h2>\n<p>1. Log in to the Azure Portal and go to <strong>Log Analytics Workspace<\/strong> service and click on create<\/p>\n<p>Note: &#8211; Log Analytics Workspace stores the runbook job logs and job stream results in a workspace to query and analyze<\/p>\n<p>2. Now fill the relevant information under <strong>Create Log Analytics workspace<\/strong> page and once done in the last, click on <strong>Review + Create and <\/strong>then <strong>Create<\/strong><\/p>\n<p><strong>Subscription:<\/strong> choose a valid subscription<\/p>\n<p>Resource<strong>\u00a0group:<\/strong> Select existing or create new<\/p>\n<p><strong>Name:<\/strong> Name for Workspace<\/p>\n<p><strong>Region:<\/strong> region for workspace<strong><u>. Configuring Automation Accounts to Start\/Stop VMs<\/u><\/strong><\/p>\n<p>3. Go to <strong>Automation Accounts<\/strong> Services and click on Create and fill in the relevant information. After that, click on <strong>Next<\/strong><\/p>\n<p><strong>Subscription:<\/strong> choose a valid subscription<\/p>\n<p><strong>Resource group:<\/strong> Select existing RG same as of workspace<\/p>\n<p><strong>Name:<\/strong> Name for Automation Account<\/p>\n<p><strong>Region:<\/strong> region same as Workspace (Central India)<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11970\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm2.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"700\" height=\"641\" \/><\/a><\/p>\n<p>4. Under the Advanced tab, select the <strong>System assigned<\/strong> checkbox and click on Under<strong> the Networking <\/strong>tab, select <strong>Public access <\/strong>and click on <strong>Review + create, <\/strong>and once validation passed, click on<strong> Create<\/strong><\/p>\n<p>5. Once the Automation Account <strong>Automation-StartStop-VM<\/strong> gets created, go inside it. Under the <strong>Related resources section, <\/strong>select <strong>Start\/Stop VM <\/strong>and then click on<strong> Learn more about and enable the solution<\/strong><a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11971\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm3.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"909\" height=\"419\" \/><\/a>6. A\u00a0new page will open; click on <strong>Create<\/strong> under <strong>Start\/Stop VMs during the off-hours<\/strong> section<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11972\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm4.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"805\" height=\"429\" \/><\/a><\/p>\n<p>7. After\u00a0clicking on Create an <strong>Add Solution<\/strong> page will open, select the <strong>Workspace<\/strong> and Select <strong>Automation Account<\/strong> created in the above steps, and after that, click on <strong>Parameters under the <\/strong>Configuration section.<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11973\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm5.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"412\" height=\"810\" \/><\/a><\/p>\n<p>8.\u00a0<strong>Parameters<\/strong> page will open and fill the relevant information: and click on<strong> OK <\/strong>and after that click on<strong> Create <\/strong>under<strong> Add Solution <\/strong>page<\/p>\n<p><strong>Target\u00a0Resource Group:<\/strong> Select the VM resource group<\/p>\n<p><strong>VM Exclude List (string):<\/strong> Enter the VM name if you want to exclude anything else. Keep<strong> none<\/strong><\/p>\n<p><strong>Daily Start\/ Stop date &amp; time:<\/strong> enter based on requirement<\/p>\n<p><strong>Email functionality:<\/strong> if yes, provide the email Id under <strong>Email Addresses<\/strong>.<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11974\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm6.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"500\" height=\"808\" \/><\/a><\/p>\n<p>9. Now\u00a0go to Automation Account <strong>Automation-StartStop-VM, click on Run as accounts under Accounts Settings Section,<\/strong> and click on <strong>Create Azure Run as Account<\/strong>. A new page will open. <strong>Add Azure Run As Account<\/strong> click on<strong> create<\/strong>.(The Run As account feature will create a new service principal user in Azure Active Directory and assign the Contributor role to this user at the subscription level.)<\/p>\n<p><strong>Note: If the account is an Azure AD account,<\/strong> it should have administrator access to perform this action.<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11975\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm7.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"615\" height=\"505\" \/><\/a><\/p>\n<p>B.\u00a0<strong><u>Configuring Schedules<\/u><\/strong><\/p>\n<p>10. Go to Automation Account <strong>Automation-StartStop-VM <\/strong>and select <strong>Schedules<\/strong> from the Shared Resources section, and modify schedules by clicking on these highlighted schedules based on the requirement. By default, linked with runbook <strong>ScheduledStartStop_Parent <\/strong>required to act once the modification is done click on<strong> Save<\/strong><\/p>\n<p><strong>Note: &#8211; <\/strong>you can also set VM to Stop on weekends by choosing the Week option from<\/p>\n<p><strong>Recur every<\/strong> and select days to start and follow the same process for Start VM<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11976\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm8.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"868\" height=\"447\" \/><\/a>C.\u00a0<strong><u>Checking Start\/Stop Jobs<\/u><\/strong><\/p>\n<p>11. Under the <strong>Jobs<\/strong> section of the Automation Account, you can keep track of logs of schedules in terms of Start\/Stop triggered.<a href=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11977\" src=\"https:\/\/content.cloudthat.com\/resources\/wp-content\/uploads\/2022\/11\/vm9.png\" alt=\"Azure Resources Virtual Machine Automation\" width=\"909\" height=\"335\" \/><\/a><\/p>\n<h3 id=\"conclusion\">4. Conclusion<\/h3>\n<p>In this blog, I have shown you how to Start\/Stop VMs on-off office hours, including weekends, and we can also keep track of Start\/Stop jobs with easy management. Furthermore, you can schedule the Start\/Stop based on your requirement. This will benefit you tremendously by saving the operational cost of the Virtual Machines. And you can make the VM available during working hours only.<\/p>\n<p>Learn more about<a href=\"https:\/\/blog.cloudthat.com\/login-to-azure-vms-using-azure-active-directory-credentials\/?utm_source=blog-website&amp;utm-medium=text-link&amp;utm_campaign=login-to-azure-vms-using-azure-active-directory-credentials\" target=\"_blank\" rel=\"noopener\"><strong>\u00a0Login to Azure VMs using Azure Active Directory Credentials<\/strong> <\/a>in this blog.<\/p>\n<h3 id=\"aboutcloudthat\">5. About CloudThat<\/h3>\n<p><a href=\"https:\/\/www.cloudthat.com\/\"><strong>CloudThat\u00a0<\/strong><\/a>is the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build\u00a0a robust\u00a0cloud computing ecosystem by disseminating\u00a0knowledge on technological intricacies within the cloud space.\u00a0Our blogs, webinars,\u00a0case studies, and white papers\u00a0enable all the stakeholders in the cloud computing sphere. Drop a query if you have any questions regarding\u00a0Azure Resources, Virtual MAchine Automation, or consulting opportunities, and I will get back to you quickly. To get started, go through\u00a0our<strong>\u00a0<\/strong><a href=\"https:\/\/www.cloudthat.com\/expert-advisory\/?utm_source=blog-website&amp;utm-medium=text-link&amp;utm_campaign=expert-advisory\"><strong>Expert Advisory<\/strong>\u00a0<\/a>page\u00a0and\u00a0<a href=\"https:\/\/www.cloudthat.com\/managed-services-packages\/\"><strong>Managed Services Package<\/strong><\/a>\u00a0that is<strong>\u00a0<a href=\"https:\/\/cloudthat.com\/?utm_source=blog-website&amp;utm-medium=text-link&amp;utm_campaign=cloudthat.com\/\">CloudThat<\/a>\u2019s<\/strong>\u00a0offerings.<\/p>\n<h3 id=\"faqs\">6. FAQs<\/h3>\n<h4><strong><span style=\"text-decoration: underline;\">1. What is Automation Account?\u00a0<\/span><\/strong><\/h4>\n<p>With an Automation account, you can authenticate runbooks by managing resources in either Azure Resource Manager or the classic deployment model. One Automation Account can manage resources across all regions and subscriptions for a given tenant.<\/p>\n<h4><span style=\"text-decoration: underline;\"><strong>2. What is the use of Log Analytics Workspace?\u00a0<\/strong><\/span><\/h4>\n<p>Log Analytics workspace is the environment for Azure Monitor log data. Each workspace has its data repository and configuration, and data sources and solutions are configured to store their data in a particular workspace.<\/p>\n<h4><span style=\"text-decoration: underline;\"><strong>3. Run as an account in Azure Automation?\u00a0<\/strong><\/span><\/h4>\n<p>Run As accounts in Azure Automation provide authentication for managing resources on the Azure Resource Manager or Azure Classic deployment model using Automation runbooks and other Automation features.<\/p>\n","protected":false},"author":280,"featured_media":12146,"parent":0,"comment_status":"open","ping_status":"open","template":"","blog_category":[3608,3607],"user_email":"mayankb@cloudthat.com","published_by":"324","primary-authors":"","secondary-authors":"","acf":[],"_links":{"self":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog\/11968"}],"collection":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/users\/280"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/comments?post=11968"}],"version-history":[{"count":2,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog\/11968\/revisions"}],"predecessor-version":[{"id":46093,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog\/11968\/revisions\/46093"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/media?parent=11968"}],"wp:term":[{"taxonomy":"blog_category","embeddable":true,"href":"https:\/\/www.cloudthat.com\/resources\/wp-json\/wp\/v2\/blog_category?post=11968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}