Manage Your Azure Resources Efficiently With Virtual Machine Automation

May 13, 2022 | Comments(0) |

TABLE OF CONTENT

1. Introduction
2. Prerequisites
3. Configuring Log Analytics Workspace
4. Conclusion
5. About CloudThat
6. FAQs

1. Introduction

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.

2. Prerequisites

  • Azure Subscription
  • Virtual Network
  • Virtual Machine

3. Configuring Log Analytics Workspace

1. Log in to the Azure Portal and go to Log Analytics Workspace service and click on create

Note: – Log Analytics Workspace stores the runbook job logs and job stream results in a workspace to query and analyze

2. Now fill the relevant information under Create Log Analytics workspace page and once done in the last, click on Review + Create and then Create

Subscription: choose a valid subscription

Resource group: Select existing or create new

Name: Name for Workspace

Region: region for workspace. Configuring Automation Accounts to Start/Stop VMs

3. Go to Automation Accounts Services and click on Create and fill in the relevant information. After that, click on Next

Subscription: choose a valid subscription

Resource group: Select existing RG same as of workspace

Name: Name for Automation Account

Region: region same as Workspace (Central India)Azure Resources Virtual Machine Automation

4. Under the Advanced tab, select the System assigned checkbox and click on Under the Networking tab, select Public access and click on Review + create, and once validation passed, click on Create

5. Once the Automation Account Automation-StartStop-VM gets created, go inside it. Under the Related resources section, select Start/Stop VM and then click on Learn more about and enable the solutionAzure Resources Virtual Machine Automation6. A new page will open; click on Create under Start/Stop VMs during the off-hours sectionAzure Resources Virtual Machine Automation

7. After clicking on Create an Add Solution page will open, select the Workspace and Select Automation Account created in the above steps, and after that, click on Parameters under the Configuration section.Azure Resources Virtual Machine Automation

8. Parameters page will open and fill the relevant information: and click on OK and after that click on Create under Add Solution page

Target Resource Group: Select the VM resource group

VM Exclude List (string): Enter the VM name if you want to exclude anything else. Keep none

Daily Start/ Stop date & time: enter based on requirement

Email functionality: if yes, provide the email Id under Email Addresses.Azure Resources Virtual Machine Automation

9. Now go to Automation Account Automation-StartStop-VM, click on Run as accounts under Accounts Settings Section, and click on Create Azure Run as Account. A new page will open. Add Azure Run As Account click on create.(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.)

Note: If the account is an Azure AD account, it should have administrator access to perform this action.Azure Resources Virtual Machine Automation

B. Configuring Schedules

10. Go to Automation Account Automation-StartStop-VM and select Schedules from the Shared Resources section, and modify schedules by clicking on these highlighted schedules based on the requirement. By default, linked with runbook ScheduledStartStop_Parent required to act once the modification is done click on Save

Note: – you can also set VM to Stop on weekends by choosing the Week option from

Recur every and select days to start and follow the same process for Start VMAzure Resources Virtual Machine AutomationC. Checking Start/Stop Jobs

11. Under the Jobs section of the Automation Account, you can keep track of logs of schedules in terms of Start/Stop triggered.Azure Resources Virtual Machine Automation

4. Conclusion

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.

Learn more about Login to Azure VMs using Azure Active Directory Credentials in this blog.

5. About CloudThat

CloudThat 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 a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere. Drop a query if you have any questions regarding Azure Resources, Virtual MAchine Automation, or consulting opportunities, and I will get back to you quickly. To get started, go through our Expert Advisory page and Managed Services Package that is CloudThat’s offerings.

6. FAQs

1. What is Automation Account? 

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.

2. What is the use of Log Analytics Workspace? 

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.

3. Run as an account in Azure Automation? 

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.


Leave a Reply