
Virtual Machine Automation makes it easy to manage your Azure resources efficiently
TABLE OF CONTENTS
1. Introduction2. Prerequisites3. Configuring Log Analytics Workspace4. Conclusion 5. CloudThat 6. FAQs1. Introduction
Management of Azure resources is a key part. As you can see, Virtual Machines cover a large portion of the cost management. Automation task templates allow you to create automated tasks for specific resources or resource groups. These tasks can vary in availability depending on the resource type. In some cases, you can even stop VMs at specific times to reduce the operation cost. This blog will show you how to start and stop VMs during office hours, weekends, and how to manage Azure Resources efficiently.
2. Prerequisites
Azure Subscription
Virtual Network
Virtual Machine
3. Configuring Log Analytics Workspace
1. Log in to Azure Portal, go to Log Analytics Workspace and click on Create.
Note: The Log Analytics Workspace stores runbook job logs as well as job stream results in a workspace that can be accessed to query and analyse.
2. Fill in the information on the Create Log Analytics workspace page. Once you are done, click on Review + Create.
Subscribe: Choose a valid subscription
Resource group: Choose existing or create a new
Name: Name for Workspace
Region: For workspace. Configuring Automation Accounts to Start/Stop Virtual Machines
3. Click on Automation Accounts Services, then click on Create to fill in the required information. Click Next after that.
Subscribe: Choose a valid subscription
Resource group: Choose an existing RG that is the same as the workspace
Name: Name for the Automation Account
Region: same as Workspace (Central India).
4. Click on the Advanced tab and select the System assigned checkbox. Next, click on the Networking tab and select Public access. Once validation is complete, click on Review + Create.
5. Once the Automation Account Automation-StartStop-VM gets created, go inside it. Select Start/Stop in the Related resources section and click on Learn More about and Enable the solution6. Click on Create in the Start/Stop Virtual Machines section to open a new page.
7. After clicking on Create an add solution page will open, select Workspace and Select Automation account created in the previous steps. Next, click on Parameters section of the Configuration section.
8. The Parameters page will open. Fill in the required information and click OK. Next, click on Create under Add Solution Page
Target Resource Group: Choose the VM resource group
VM Exclude List String: Enter the VM name to exclude any other. None
Daily Start/Stop date & Time: Enter based on your requirement
Email functionality: If yes, please provide the email ID under Email Addresses.
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 be opened. Add Azure Run As Account click on create. (The Run As account feature will create an Azure Active Directory service principal user and assign the Contributor role at the subscription level to this user.
Note: If the account belongs to an Azure AD account, it must have administrator access to perform this action.
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
You can also set VM Stop on weekends by selecting the Week option.
Start VMC: Recur every day and on a few days. Follow the same process. Check out Start/Stop Jobs
11. You can track logs of all schedules under the Jobs section of your Automation Account.