Adatum Corporation wishes to minimize administrative overhead as much as possible, especially for tasks that involve management of VMs. For this reason, as part of Adatum’s evaluation of Microsoft Azure, you have been asked to configure an Automation account and use its features to automate the most common VM management tasks.
After completing this lab, you will be able to:
-
Configure Automation accounts.
-
Create runbooks.
Estimated Time: 40 minutes
Virtual Machine: 20533E-MIA-CL1
User Name: Student
Password: Pa55w.rd
Before starting this lab, ensure that you have performed the "Preparing the Azure environment" demonstration tasks at the beginning of the first lesson in this module and that the Setup-Azure script has completed.
Administrators at Adatum Corporation spend considerable time managing VMs. You want to increase administrator productivity by using Automation to manage VMs.
The main tasks for this exercise are as follows:
-
Create an Automation account
-
Create and review Automation assets
-
Ensure that you are signed in to MIA-CL1 as Student with the password Pa55w.rd, and that the setup script you ran in the previous demonstration to prepare the environment has completed.
-
Start Microsoft Edge and sign in to the Azure portal by using the Microsoft account that is the Service Administrator of your Azure subscription. If necessary, in the Azure portal, switch to the Azure Active Directory tenant associated with the Azure subscription that you chose when running the provisioning script at the beginning of this module.
-
From the Virtual machines blade, note that 20533E1101-vm0 and 20533E1101-vm1 virtual machines are currently running.
-
Create a new Azure Automation account with the following settings:
-
Name: AutomationAccount-20533E11
-
Subscription: the name of your Azure subscription
-
Resource group: ensure that the Create new option is selected and type 20533E1102-LabRG in the text box
-
Location: the same Azure region that you chose when running Add-20533EEnvironment script at the beginning of this module or, if not available, another region close to it
-
Create Azure Run As account: Yes
- Wait for the Automation account to be provisioned. This should take less than a minute.
- In the Azure portal, from the AutomationAccount-20533E11 blade, create the following Azure Automation non-encrypted string variables
-
Name: VM0
-
Description: the first VM
-
Type: String
-
Value: 20533E1101-vm0
-
Encrypted: No
-
Name: VM1
-
Description: the second VM
-
Type: String
-
Value: 20533E1101-vm1
-
Encrypted: No
-
Name: ResourceGroup
-
Description: VM resource group
-
Type: String
-
Value: 20533E1101-LabRG
-
Encrypted: No
- In the same Automation account, create the following Schedule asset:
-
Name: EndOfDay
-
Description: End of day
-
Starts: tomorrow's date at 6:00:00 PM with the time zone of the Azure region containing the Automation account
-
Recurrence: Recurring
-
Recur every: 1 Day
-
Set expiration: No
- In the list of assets, note two precreated connections AzureClassicRunAsConnection and AzureRunAsConnection. They were created automatically during provisioning of the Automation account since you selected the option to create the Azure Run As account.
Result: After completing this exercise, you should have configured a new Azure Automation account, created Automation variable assets and Automation schedule asset, and reviewed the precreated Azure Automation connection assets
As part of your tests of the new Automation features, you will stop an Azure VM by using an Automation runbook.
The main tasks for this exercise are as follows:
-
Import a runbook
-
Publish and execute a runbook
-
Remove the lab environment
-
From the Azure portal, import the PowerShell workflow script F:\Labfiles\Lab11\Starter\Stop-20533E1101VMs.ps1 into your Automation account.
-
Review the content of the runbook.
-
Publish the Stop-AzureVMs-Workflow runbook.
-
Start the newly published runbook.
-
View the progress of the runbook execution. Wait until the job completes.
-
From the Azure portal, verify that the of 20533E1101-vm0 and 20533E1101-vm1 virtual machines have been stopped.
-
On MIA-CL1, close all open windows without saving any files.
-
Start Windows PowerShell as Administrator and, from the Administrator: Windows PowerShell window, run Remove-20533EEnvironment.
-
When prompted, sign in by using the Microsoft account that is the Service Administrator of your Azure subscription.
-
If you have multiple Azure subscriptions, select the one you want the script to target.
-
If prompted, specify the current lab number.
-
When prompted for confirmation, type y.
-
Start Microsoft Edge, browse to the Azure portal, and sign in by using the Microsoft account that is the Service Administrator of your Azure subscription.
-
In the Azure portal, reset the dashboard to the default state.
-
Close all open windows.
Result: After completing this exercise, you should have imported, published, and executed a PowerShell workflow-based runbook that deploys two virtual machines in parallel.
Question What mechanism did you use to authenticate when accessing the Azure subscription when running the Azure Automation runbook in the lab?
Question What should you consider when testing the execution of an Automation runbook?
©2016 Microsoft Corporation. All rights reserved.
The text in this document is available under the Creative Commons Attribution 3.0 License, additional terms may apply. All other content contained in this document (including, without limitation, trademarks, logos, images, etc.) are not included within the Creative Commons license grant. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.
This document is provided "as-is." Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. Some examples are for illustration only and are fictitious. No real association is intended or inferred. Microsoft makes no warranties, express or implied, with respect to the information provided here.