Upload files to "AZ104/MicrosoftAureAdministrator/Instructions/Labs"

This commit is contained in:
2023-10-06 04:39:20 -07:00
parent 325e4c65d5
commit 518bee22c4
2 changed files with 797 additions and 0 deletions

View File

@@ -0,0 +1,461 @@
---
lab:
title: '10 - Implement Data Protection'
module: 'Module 10 - Data Protection'
---
# Lab 10 - Backup virtual machines
# Student lab manual
## Lab scenario
You have been tasked with evaluating the use of Azure Recovery Services for backup and restore of files hosted on Azure virtual machines and on-premises computers. In addition, you want to identify methods of protecting data stored in the Recovery Services vault from accidental or malicious data loss.
## Objectives
In this lab, you will:
+ Task 1: Provision the lab environment
+ Task 2: Create a Recovery Services vault
+ Task 3: Implement Azure virtual machine-level backup
+ Task 4: Implement File and Folder backup
+ Task 5: Perform file recovery by using Azure Recovery Services agent
+ Task 6: Perform file recovery by using Azure virtual machine snapshots (optional)
+ Task 7: Review the Azure Recovery Services soft delete functionality (optional)
## Estimated timing: 50 minutes
## Instructions
### Exercise 1
#### Task 1: Provision the lab environment
In this task, you will deploy two virtual machines that will be used to test different backup scenarios.
1. Sign in to the [Azure portal](https://portal.azure.com).
1. In the Azure portal, open the **Azure Cloud Shell** by clicking on the icon in the top right of the Azure Portal.
1. If prompted to select either **Bash** or **PowerShell**, select **PowerShell**.
>**Note**: If this is the first time you are starting **Cloud Shell** and you are presented with the **You have no storage mounted** message, select the subscription you are using in this lab, and click **Create storage**.
1. In the toolbar of the Cloud Shell pane, click the **Upload/Download files** icon, in the drop-down menu, click **Upload** and upload the files **\\Allfiles\\Labs\\10\\az104-10-vms-edge-template.json** and **\\Allfiles\\Labs\\10\\az104-10-vms-edge-parameters.json** into the Cloud Shell home directory.
1. From the Cloud Shell pane, run the following to create the resource group that will be hosting the virtual machines (replace the `[Azure_region]` placeholder with the name of an Azure region where you intend to deploy Azure virtual machines):
```powershell
$location = '[Azure_region]'
$rgName = 'az104-10-rg0'
New-AzResourceGroup -Name $rgName -Location $location
```
1. From the Cloud Shell pane, run the following to create the first virtual network and deploy a virtual machine into it by using the template and parameter files you uploaded:
```powershell
New-AzResourceGroupDeployment `
-ResourceGroupName $rgName `
-TemplateFile $HOME/az104-10-vms-edge-template.json `
-TemplateParameterFile $HOME/az104-10-vms-edge-parameters.json `
-AsJob
```
1. Minimize Cloud Shell (but do not close it).
>**Note**: Do not wait for the deployment to complete but instead proceed to the next task. The deployment should take about 5 minutes.
#### Task 2: Create a Recovery Services vault
In this task, you will create a recovery services vault.
1. In the Azure portal, search for and select **Recovery Services vaults** and, on the **Recovery Services vaults** blade, click **+ Create**.
1. On the **Create Recovery Services vault** blade, specify the following settings:
| Settings | Value |
| --- | --- |
| Subscription | the name of the Azure subscription you are using in this lab |
| Resource group | the name of a new resource group **az104-10-rg1** |
| Vault Name | **az104-10-rsv1** |
| Region | the name of a region where you deployed the two virtual machines in the previous task |
>**Note**: Make sure that you specify the same region into which you deployed virtual machines in the previous task.
1. Click **Review + Create**, ensure that the validation passed and click **Create**.
>**Note**: Wait for the deployment to complete. The deployment should take less than 1 minute.
1. When the deployment is completed, click **Go to Resource**.
1. On the **az104-10-rsv1** Recovery Services vault blade, in the **Settings** section, click **Properties**.
1. On the **az104-10-rsv1 - Properties** blade, click the **Update** link under **Backup Configuration** label.
1. On the **Backup Configuration** blade, note that you can set the **Storage replication type** to either **Locally-redundant** or **Geo-redundant**. Leave the default setting of **Geo-redundant** in place and close the blade.
>**Note**: This setting can be configured only if there are no existing backup items.
1. Back on the **az104-10-rsv1 - Properties** blade, click the **Update** link under **Security Settings** label.
1. On the **Security Settings** blade, note that **Soft Delete (For Azure Virtual Machines)** is **Enabled**.
1. Close the **Security Settings** blade and, back on the **az104-10-rsv1** Recovery Services vault blade, click **Overview**.
#### Task 3: Implement Azure virtual machine-level backup
In this task, you will implement Azure virtual-machine level backup.
>**Note**: Before you start this task, make sure that the deployment you initiated in the first task of this lab has successfully completed.
1. On the **az104-10-rsv1** Recovery Services vault blade, click **Overview**, then click **+ Backup**.
1. On the **Backup Goal** blade, specify the following settings:
| Settings | Value |
| --- | --- |
| Where is your workload running? | **Azure** |
| What do you want to backup? | **Virtual machine** |
1. On the **Backup Goal** blade, click **Backup**.
1. On the **Backup policy**, review the **DefaultPolicy** settings and select **Create a new policy**.
1. Define a new backup policy with the following settings (leave others with their default values):
| Setting | Value |
| ---- | ---- |
| Policy name | **az104-10-backup-policy** |
| Frequency | **Daily** |
| Time | **12:00 AM** |
| Timezone | the name of your local time zone |
| Retain instant recovery snapshot(s) for | **2** Days(s) |
1. Click **OK** to create the policy and then, in the **Virtual Machines** section, select **Add**.
1. On the **Select virtual machines** blade, select **az-104-10-vm0**, click **OK**, and, back on the **Backup** blade, click **Enable backup**.
>**Note**: Wait for the backup to be enabled. This should take about 2 minutes.
1. Navigate back to the **az104-10-rsv1** Recovery Services vault blade, in the **Protected items** section, click **Backup items**, and then click the **Azure virtual machines** entry.
1. On the **Backup Items (Azure Virtual Machine)** blade of **az104-10-vm0**, review the values of the **Backup Pre-Check** and **Last Backup Status** entries, and click the **az104-10-vm0** entry.
1. On the **az104-10-vm0** Backup Item blade, click **Backup now**, accept the default value in the **Retain Backup Till** drop-down list, and click **OK**.
>**Note**: Do not wait for the backup to complete but instead proceed to the next task.
#### Task 4: Implement File and Folder backup
In this task, you will implement file and folder backup by using Azure Recovery Services.
1. In the Azure portal, search for and select **Virtual machines**, and on the **Virtual machines** blade, click **az104-10-vm1**.
1. On the **az104-10-vm1** blade, click **Connect**, in the drop-down menu, click **RDP**, on the **Connect with RDP** blade, click **Download RDP File** and follow the prompts to start the Remote Desktop session.
>**Note**: This step refers to connecting via Remote Desktop from a Windows computer. On a Mac, you can use Remote Desktop Client from the Mac App Store and on Linux computers you can use an open source RDP client software.
>**Note**: You can ignore any warning prompts when connecting to the target virtual machines.
1. When prompted, sign in by using the **Student** username and **Pa55w.rd1234** password.
>**Note:** Because the Azure portal doesn't support IE11 anymore, you'll have to use the Microsoft Edge Browser for this task.
1. Within the Remote Desktop session to the **az104-10-vm1** Azure virtual machine, start an Edge web browser, browse to the [Azure portal](https://portal.azure.com), and sign in using your credentials.
1. In the Azure portal, search for and select **Recovery Services vaults** and, on the **Recovery Services vaults**, click **az104-10-rsv1**.
1. On the **az104-10-rsv1** Recovery Services vault blade, click **+ Backup**.
1. On the **Backup Goal** blade, specify the following settings:
| Settings | Value |
| --- | --- |
| Where is your workload running? | **On-premises** |
| What do you want to backup? | **Files and folders** |
>**Note**: Even though the virtual machine you are using in this task is running in Azure, you can leverage it to evaluate the backup capabilities applicable to any on-premises computer running Windows Server operating system.
1. On the **Backup Goal** blade, click **Prepare infrastructure**.
1. On the **Prepare infrastructure** blade, click the **Download Agent for Windows Server or Windows Client** link.
1. When prompted, click **Run** to start installation of **MARSAgentInstaller.exe** with the default settings.
>**Note**: On the **Microsoft Update Opt-In** page of the **Microsoft Azure Recovery Services Agent Setup Wizard**, select the **I do not want to use Microsoft Update** installation option.
1. On the **Installation** page of the **Microsoft Azure Recovery Services Agent Setup Wizard**, click **Proceed to Registration**. This will start **Register Server Wizard**.
1. Switch to the web browser window displaying the Azure portal, on the **Prepare infrastructure** blade, select the checkbox **Already downloaded or using the latest Recovery Server Agent**, and click **Download**.
1. When prompted, whether to open or save the vault credentials file, click **Save**. This will save the vault credentials file to the local Downloads folder.
1. Switch back to the **Register Server Wizard** window and, on the **Vault Identification** page, click **Browse**.
1. In the **Select Vault Credentials** dialog box, browse to the **Downloads** folder, click the vault credentials file you downloaded, and click **Open**.
1. Back on the **Vault Identification** page, click **Next**.
1. On the **Encryption Setting** page of the **Register Server Wizard**, click **Generate Passphrase**.
1. On the **Encryption Setting** page of the **Register Server Wizard**, click the **Browse** button next to the **Enter a location to save the passphrase** drop-down list.
1. In the **Browse For Folder** dialog box, select the **Documents** folder and click **OK**.
1. Click **Finish**, review the **Microsoft Azure Backup** warning and click **Yes**, and wait for the registration to complete.
>**Note**: In a production environment, you should store the passphrase file in a secure location other than the server being backed up.
1. On the **Server Registration** page of the **Register Server Wizard**, review the warning regarding the location of the passphrase file, ensure that the **Launch Microsoft Azure Recovery Services Agent** checkbox is selected and click **Close**. This will automatically open the **Microsoft Azure Backup** console.
1. In the **Microsoft Azure Backup** console, in the **Actions** pane, click **Schedule Backup**.
1. In the **Schedule Backup Wizard**, on the **Getting started** page, click **Next**.
1. On the **Select Items to Backup** page, click **Add Items**.
1. In the **Select Items** dialog box, expand **C:\\Windows\\System32\\drivers\\etc\\**, select **hosts**, and then click **OK**:
1. On the **Select Items to Backup** page, click **Next**.
1. On the **Specify Backup Schedule** page, ensure that the **Day** option is selected, in the first drop-down list box below the **At following times (Maximum allowed is three times a day)** box, select **4:30 AM**, and then click **Next**.
1. On the **Select Retention Policy** page, accept the defaults, and then click **Next**.
1. On the **Choose Initial Backup type** page, accept the defaults, and then click **Next**.
1. On the **Confirmation** page, click **Finish**. When the backup schedule is created, click **Close**.
1. In the **Microsoft Azure Backup** console, in the Actions pane, click **Back Up Now**.
>**Note**: The option to run backup on demand becomes available once you create a scheduled backup.
1. In the Back Up Now Wizard, on the **Select Backup Item** page, ensure that the **Files and Folders** option is selected and click **Next**.
1. On the **Retain Backup Till** page, accept the default setting and click **Next**.
1. On the **Confirmation** page, click **Back Up**.
1. When the backup is complete, click **Close**, and then close Microsoft Azure Backup.
1. Switch to the web browser window displaying the Azure portal, navigate back to the **Recovery Services vault** blade, in the **Protected items** section, and click **Backup items**.
1. On the **az104-10-rsv1 - Backup items** blade, click **Azure Backup Agent**.
1. On the **Backup Items (Azure Backup Agent)** blade, verify that there is an entry referencing the **C:\\** drive of **az104-10-vm1.**.
#### Task 5: Perform file recovery by using Azure Recovery Services agent (optional)
In this task, you will perform file restore by using Azure Recovery Services agent.
1. Within the Remote Desktop session to **az104-10-vm1**, open File Explorer, navigate to the **C:\\Windows\\System32\\drivers\\etc\\** folder and delete the **hosts** file.
1. Open Microsoft Azure Backup and click **Recover data** in the **Actions** pane. This will start **Recover Data Wizard**.
1. On the **Getting Started** page of **Recover Data Wizard**, ensue that **This server (az104-10-vm1.)** option is selected and click **Next**.
1. On the **Select Recovery Mode** page, ensure that **Individual files and folders** option is selected, and click **Next**.
1. On the **Select Volume and Date** page, in the **Select the volume** drop down list, select **C:\\**, accept the default selection of the available backup, and click **Mount**.
>**Note**: Wait for the mount operation to complete. This might take about 2 minutes.
1. On the **Browse And Recover Files** page, note the drive letter of the recovery volume and review the tip regarding the use of robocopy.
1. Click **Start**, expand the **Windows System** folder, and click **Command Prompt**.
1. From the Command Prompt, run the following to copy the restore the **hosts** file to the original location (replace `[recovery_volume]` with the drive letter of the recovery volume you identified earlier):
```sh
robocopy [recovery_volume]:\Windows\System32\drivers\etc C:\Windows\system32\drivers\etc hosts /r:1 /w:1
```
1. Switch back to the **Recover Data Wizard** and, on the **Browse and Recover Files**, click **Unmount** and, when prompted to confirm, click **Yes**.
1. Terminate the Remote Desktop session.
#### Task 6: Perform file recovery by using Azure virtual machine snapshots (optional)
In this task, you will restore a file from the Azure virtual machine-level snapshot-based backup.
1. Switch to the browser window running on your lab computer and displaying the Azure portal.
1. In the Azure portal, search for and select **Virtual machines**, and on the **Virtual machines** blade, click **az104-10-vm0**.
1. On the **az104-10-vm0** blade, click **Connect**, in the drop-down menu, click **RDP**, on the **Connect with RDP** blade, click **Download RDP File** and follow the prompts to start the Remote Desktop session.
>**Note**: This step refers to connecting via Remote Desktop from a Windows computer. On a Mac, you can use Remote Desktop Client from the Mac App Store and on Linux computers you can use an open source RDP client software.
>**Note**: You can ignore any warning prompts when connecting to the target virtual machines.
1. When prompted, sign in by using the **Student** username and **Pa55w.rd1234** password.
>**Note:** Because the Azure portal doesn't support IE11 anymore, you'll have to use the Microsoft Edge Browser for this task.
1. Within the Remote Desktop session to the **az104-10-vm0**, click **Start**, expand the **Windows System** folder, and click **Command Prompt**.
1. From the Command Prompt, run the following to delete the **hosts** file:
```sh
del C:\Windows\system32\drivers\etc\hosts
```
>**Note**: You will restore this file from the Azure virtual machine-level snapshot-based backup later in this task.
1. Within the Remote Desktop session to the **az104-10-vm0** Azure virtual machine, start an Edge web browser, browse to the [Azure portal](https://portal.azure.com), and sign in using your credentials.
1. In the Azure portal, search for and select **Recovery Services vaults** and, on the **Recovery Services vaults**, click **az104-10-rsv1**.
1. On the **az104-10-rsv1** Recovery Services vault blade, in the **Protected items** section, click **Backup items**.
1. On the **az104-10-rsv1 - Backup items** blade, click **Azure Virtual Machine**.
1. On the **Backup Items (Azure Virtual Machine)** blade, click **az104-10-vm0**.
1. On the **az104-10-vm0** Backup Item blade, click **File Recovery**.
>**Note**: You have the option of running recovery shortly after backup starts based on the application consistent snapshot.
1. On the **File Recovery** blade, accept the default recovery point and click **Download Executable**.
>**Note**: The script mounts the disks from the selected recovery point as local drives within the operating system from which the script is run.
1. Click **Download** and, when prompted whether to run or save **IaaSVMILRExeForWindows.exe**, click **Save**.
1. Start File Explorer, navigate to the **Downloads** folder, right-click the newly downloaded file, select **Properties** in the right-click menu, in the **Properties** dialog box, select the **Unblock** checkbox, and click **OK**.
1. Back in the File Explorer window, double-click the newly downloaded file.
1. When prompted to provide the password from the portal, copy the password from the **Password to run the script** text box on the **File Recovery** blade, paste it at the Command Prompt, and press **Enter**.
>**Note**: This will open a Windows PowerShell window displaying the progress of the mount.
>**Note**: If you receive an error message at this point, refresh the web browser window and repeat the last three steps.
1. Wait for the mount process to complete, review the informational messages in the Windows PowerShell window, note the drive letter assigned to the volume hosting **Windows**, and start File Explorer.
1. In File Explorer, navigate to the drive letter hosting the snapshot of the operating system volume you identified in the previous step and review its content.
1. Switch to the **Command Prompt** window.
1. From the Command Prompt, run the following to copy the restore the **hosts** file to the original location (replace `[os_volume]` with the drive letter of the operating system volume you identified earlier):
```sh
robocopy [os_volume]:\Windows\System32\drivers\etc C:\Windows\system32\drivers\etc hosts /r:1 /w:1
```
1. Switch back to the **File Recovery** blade in the Azure portal and click **Unmount Disks**.
1. Terminate the Remote Desktop session.
#### Task 7: Review the Azure Recovery Services soft delete functionality
1. On the lab computer, in the Azure portal, search for and select **Recovery Services vaults** and, on the **Recovery Services vaults**, click **az104-10-rsv1**.
1. On the **az104-10-rsv1** Recovery Services vault blade, in the **Protected items** section, click **Backup items**.
1. On the **az104-10-rsv1 - Backup items** blade, click **Azure Backup Agent**.
1. On the **Backup Items (Azure Backup Agent)** blade, click the entry representing the backup of **az104-10-vm1**.
1. On the **C:\\ on az104-10-vm1.** blade, click the **az104-10-vm1.** link.
1. On the **az104-10-vm1.** Protected Servers blade, click **Delete**.
1. On the **Delete** blade, specify the following settings.
| Settings | Value |
| --- | --- |
| TYPE THE SERVER NAME | **az104-10-vm1.** |
| Reason | **Recycling Dev/Test server** |
| Comments | **az104 10 lab** |
>**Note**: Make sure to include the trailing period when typing the server name
1. Enable the checkbox next to the label **There is backup data of 1 backup items associated with this server. I understand that clicking "Confirm" will permanently delete all the cloud backup data. This action cannot be undone. An alert may be sent to the administrators of this subscription notifying them of this deletion** and click **Delete**.
1. Navigate back to the **az104-10-rsv1 - Backup items** blade and click **Azure Virtual Machines**.
1. On the **az104-10-rsv1 - Backup items** blade, click **Azure Virtual Machine**.
1. On the **Backup Items (Azure Virtual Machine)** blade, click **az104-10-vm0**.
1. On the **az104-10-vm0** Backup Item blade, click **Stop backup**.
1. On the **Stop backup** blade, select **Delete Backup Data**, specify the following settings and click **Stop backup**:
| Settings | Value |
| --- | --- |
| Type the name of Backup item | **az104-10-vm0** |
| Reason | **Others** |
| Comments | **az104 10 lab** |
1. Navigate back to the **az104-10-rsv1 - Backup items** blade and click **Refresh**.
>**Note**: The **Azure Virtual Machine** entry is still lists **1** backup item.
1. Click the **Azure Virtual Machine** entry and, on the **Backup Items (Azure Virtual Machine)** blade, click the **az104-10-vm0** entry.
1. On the **az104-10-vm0** Backup Item blade, note that you have the option to **Undelete** the deleted backup.
>**Note**: This functionality is provided by the soft-delete feature, which is, by default, enabled for Azure virtual machine backups.
1. Navigate back to the **az104-10-rsv1** Recovery Services vault blade, and in the **Settings** section, click **Properties**.
1. On the **az104-10-rsv1 - Properties** blade, click the **Update** link under **Security Settings** label.
1. On the **Security Settings** blade, Disable **Soft Delete (For eligible Backup Management Types)** and click **Save**.
>**Note**: This will not affect items already in soft delete state.
1. Close the **Security Settings** blade and, back on the **az104-10-rsv1** Recovery Services vault blade, click **Overview**.
1. Navigate back to the **az104-10-vm0** Backup Item blade and click **Undelete**.
1. On the **Undelete az104-10-vm0** blade, click **Undelete**.
1. Wait for the undelete operation to complete, refresh the web browser page, if needed, navigate back to the **az104-10-vm0** Backup Item blade, and click **Delete backup data**.
1. On the **Delete Backup Data** blade, specify the following settings and click **Delete**:
| Settings | Value |
| --- | --- |
| Type the name of Backup item | **az104-10-vm0** |
| Reason | **Others** |
| Comments | **az104 10 lab** |
#### Clean up resources
>**Note**: Remember to remove any newly created Azure resources that you no longer use. Removing unused resources ensures you will not see unexpected charges.
1. In the Azure portal, open the **PowerShell** session within the **Cloud Shell** pane.
1. List all resource groups created throughout the labs of this module by running the following command:
```powershell
Get-AzResourceGroup -Name 'az104-10*'
```
1. Delete all resource groups you created throughout the labs of this module by running the following command:
```powershell
Get-AzResourceGroup -Name 'az104-10*' | Remove-AzResourceGroup -Force -AsJob
```
>**Note**: Optionally, you might consider deleting the auto-generated resource group with the prefix **AzureBackupRG_** (there is no additional charge associated with its existence).
>**Note**: The command executes asynchronously (as determined by the -AsJob parameter), so while you will be able to run another PowerShell command immediately afterwards within the same PowerShell session, it will take a few minutes before the resource groups are actually removed.
#### Review
In this lab, you have:
+ Provisioned the lab environment
+ Created a Recovery Services vault
+ Implemented Azure virtual machine-level backup
+ Implemented File and Folder backup
+ Performed file recovery by using Azure Recovery Services agent
+ Performed file recovery by using Azure virtual machine snapshots
+ Reviewed the Azure Recovery Services soft delete functionality

View File

@@ -0,0 +1,336 @@
---
lab:
title: '11 - Implement Monitoring'
module: 'Module 11 - Monitoring'
---
# Lab 11 - Implement Monitoring
# Student lab manual
## Lab scenario
You need to evaluate Azure functionality that would provide insight into performance and configuration of Azure resources, focusing in particular on Azure virtual machines. To accomplish this, you intend to examine the capabilities of Azure Monitor, including Log Analytics.
## Objectives
In this lab, you will:
+ Task 1: Provision the lab environment
+ Task 2: Create and configure an Azure Log Analytics workspace and Azure Automation-based solutions
+ Task 3: Review default monitoring settings of Azure virtual machines
+ Task 4: Configure Azure virtual machine diagnostic settings
+ Task 5: Review Azure Monitor functionality
+ Task 6: Review Azure Log Analytics functionality
## Estimated timing: 45 minutes
## Instructions
### Exercise 1
#### Task 1: Provision the lab environment
In this task, you will deploy a virtual machine that will be used to test monitoring scenarios.
1. Sign in to the [Azure portal](https://portal.azure.com).
1. In the Azure portal, open the **Azure Cloud Shell** by clicking on the icon in the top right of the Azure Portal.
1. If prompted to select either **Bash** or **PowerShell**, select **PowerShell**.
>**Note**: If this is the first time you are starting **Cloud Shell** and you are presented with the **You have no storage mounted** message, select the subscription you are using in this lab, and click **Create storage**.
1. In the toolbar of the Cloud Shell pane, click the **Upload/Download files** icon, in the drop-down menu, click **Upload** and upload the files **\\Allfiles\\Labs\\11\\az104-11-vm-template.json** and **\\Allfiles\\Labs\\11\\az104-11-vm-parameters.json** into the Cloud Shell home directory.
1. From the Cloud Shell pane, run the following to create the resource group that will be hosting the virtual machines (replace the `[Azure_region]` placeholder with the name of an Azure region where you intend to deploy Azure virtual machines):
>**Note**: Make sure to choose one of the regions listed as **Log Analytics Workspace Region** in the referenced in [Workspace mappings documentation](https://docs.microsoft.com/en-us/azure/automation/how-to/region-mappings)
```powershell
$location = '[Azure_region]'
$rgName = 'az104-11-rg0'
New-AzResourceGroup -Name $rgName -Location $location
```
1. From the Cloud Shell pane, run the following to create the first virtual network and deploy a virtual machine into it by using the template and parameter files you uploaded:
```powershell
New-AzResourceGroupDeployment `
-ResourceGroupName $rgName `
-TemplateFile $HOME/az104-11-vm-template.json `
-TemplateParameterFile $HOME/az104-11-vm-parameters.json `
-AsJob
```
>**Note**: Do not wait for the deployment to complete but instead proceed to the next task. The deployment should take about 3 minutes.
#### Task 2: Register the Microsoft.Insights and Microsoft.AlertsManagement resource providers.
1. From the Cloud Shell pane, run the following to register the Microsoft.Insights and Microsoft.AlertsManagement resource providers.
```powershell
Register-AzResourceProvider -ProviderNamespace Microsoft.Insights
Register-AzResourceProvider -ProviderNamespace Microsoft.AlertsManagement
```
1. Minimize Cloud Shell pane (but do not close it).
#### Task 3: Create and configure an Azure Log Analytics workspace and Azure Automation-based solutions
In this task, you will create and configure an Azure Log Analytics workspace and Azure Automation-based solutions
1. In the Azure portal, search for and select **Log Analytics workspaces** and, on the **Log Analytics workspaces** blade, click **+ Create**.
1. On the **Basics** tab of the **Create Log Analytics workspace** blade, enter the following settings, click **Review + Create** and then click **Create**:
| Settings | Value |
| --- | --- |
| Subscription | the name of the Azure subscription you are using in this lab |
| Resource group | the name of a new resource group **az104-11-rg1** |
| Log Analytics Workspace | any unique name |
| Region | the name of the Azure region into which you deployed the virtual machine in the previous task |
>**Note**: Make sure that you specify the same region into which you deployed virtual machines in the previous task.
>**Note**: Wait for the deployment to complete. The deployment should take about 1 minute.
1. In the Azure portal, search for and select **Automation Accounts**, and on the **Automation Accounts** blade, click **+ Create**.
1. On the **Add Automation Account** blade, specify the following settings, and click **Create**:
| Settings | Value |
| --- | --- |
| Name | any unique name |
| Subscription | the name of the Azure subscription you are using in this lab |
| Resource group | **az104-11-rg1** |
| Location | the name of the Azure region determined based on [Workspace mappings documentation](https://docs.microsoft.com/en-us/azure/automation/how-to/region-mappings) |
| Create Azure Run As account | **Yes** |
>**Note**: Make sure that you specify the Azure region based on the [Workspace mappings documentation](https://docs.microsoft.com/en-us/azure/automation/how-to/region-mappings)
>**Note**: Wait for the deployment to complete. The deployment might take about 3 minutes.
1. On the **Add Automation Account** blade, click **Refresh** and then click the entry representing your newly created Automation account.
1. On the Automation account blade, in the **Configuration Management** section, click **Inventory**.
1. In the **Inventory** pane, in the **Log Analytics workspace** drop-down list, select the Log Analytics workspace you created earlier in this task and click **Enable**.
>**Note**: Wait for the installation of the corresponding Log Analytics solution to complete. This might take about 3 minutes.
>**Note**: This automatically installs the **Change tracking** solution as well.
1. On the Automation account blade, in the **Update Management** section, click **Update management** and click **Enable**.
>**Note**: Wait for the installation to complete. This might take about 5 minutes.
#### Task 4: Review default monitoring settings of Azure virtual machines
In this task, you will review default monitoring settings of Azure virtual machines
1. In the Azure portal, search for and select **Virtual machines**, and on the **Virtual machines** blade, click **az104-11-vm0**.
1. On the **az104-11-vm0** blade, in the **Monitoring** section, click **Metrics**.
1. On the **az104-11-vm0 \| Metrics** blade, on the default chart, note that the only available **Metrics Namespace** is **Virtual Machine Host**.
>**Note**: This is expected, since no guest-level diagnostic settings have been configured yet. You do have, however, the option of enabling guest memory metrics directly from the **Metrics Namespace** drop down-list. You will enable it later in this exercise.
1. In the **Metric** drop-down list, review the list of available metrics.
>**Note**: The list includes a range of CPU, disk, and network-related metrics that can be collected from the virtual machine host, without having access into guest-level metrics.
1. In the **Metric** drop-down list, select **Percentage CPU**, in the **Aggregation** drop-down list, select **Avg**, and review the resulting chart.
#### Task 5: Configure Azure virtual machine diagnostic settings
In this task, you will configure Azure virtual machine diagnostic settings.
1. On the **az104-11-vm0** blade, in the **Monitoring** section, click **Diagnostic settings**.
1. On the **Overview** tab of the **az104-11-vm0 \| Diagnostic settings** blade, click **Enable guest-level monitoring**.
>**Note**: Wait for the operation to take effect. This might take about 3 minutes.
1. Switch to the **Performance counters** tab of the **az104-11-vm0 \| Diagnostic settings** blade and review the available counters.
>**Note**: By default, CPU, memory, disk, and network counters are enabled. You can switch to the **Custom** view for more detailed listing.
1. Switch to the **Logs** tab of the **az104-11-vm0 \| Diagnostic settings** blade and review the available event log collection options.
>**Note**: By default, log collection includes critical, error, and warning entries from the Application Log and System log, as well as Audit failure entries from the Security log. Here as well you can switch to the **Custom** view for more detailed configuration settings.
1. On the **az104-11-vm0** blade, in the **Monitoring** section, click **Logs** and then click **Enable**.
1. On the **az104-11-vm0 - Logs** blade, ensure that the Log Analytics workspace you created earlier in this lab is selected in the **Choose a Log Analytics Workspace** drop-down list and click **Enable**.
>**Note**: Do not wait for the operation to complete but instead proceed to the next step. The operation might take about 5 minutes.
1. On the **az104-11-vm0 \| Logs** blade, in the **Monitoring** section, click **Metrics**.
1. On the **az104-11-vm0 \| Metrics** blade, on the default chart, note that at this point, the **Metrics Namespace** drop-down list, in addition to the **Virtual Machine Host** entry includes also the **Guest (classic)** entry.
>**Note**: This is expected, since you enabled guest-level diagnostic settings. You also have the option to **Enable new guest memory metrics**.
1. In the **Metrics Namespace** drop-down list, select the **Guest (classic)** entry.
1. In the **Metric** drop-down list, review the list of available metrics.
>**Note**: The list includes additional guest-level metrics not available when relying on the host-level monitoring only.
1. In the **Metric** drop-down list, select **Memory\\Available Bytes**, in the **Aggregation** drop-down list, select **Max**, and review the resulting chart.
#### Task 6: Review Azure Monitor functionality
1. In the Azure portal, search for and select **Monitor** and, on the **Monitor \| Overview** blade, click **Metrics**.
1. On the **Select a scope** blade, on the **Browse** tab, navigate to the **az104-11-rg0** resource group, expand it, select the checkbox next to the **az104-11-vm0** virtual machine entry within that resource group, and click **Apply**.
>**Note**: This gives you the same view and options as those available from the **az104-11-vm0 - Metrics** blade.
1. In the **Metric** drop-down list, select **Percentage CPU**, in the **Aggregation** drop-down list, select **Avg**, and review the resulting chart.
1. On the **Monitor \| Metrics** blade, on the **Avg Percentage CPU for az104-11-vm0** pane, click **New alert rule**.
>**Note**: Creating an alert rule from Metrics is not supported for metrics from the Guest (classic) metric namespace. This can be accomplished by using Azure Resource Manager templates, as described in the document [Send Guest OS metrics to the Azure Monitor metric store using a Resource Manager template for a Windows virtual machine](https://docs.microsoft.com/en-us/azure/azure-monitor/platform/collect-custom-metrics-guestos-resource-manager-vm)
1. On the **Create alert rule** blade, in the **Condition** section, click the existing condition entry.
1. On the **Configure signal logic** blade, in the list of signals, in the **Alert logic** section, specify the following settings (leave others with their default values) and click **Done**:
| Settings | Value |
| --- | --- |
| Threshold | **Static** |
| Operator | **Greater than** |
| Aggregation type | **Average** |
| Threshold value | **2** |
| Aggregation granularity (Period) | **1 minute** |
| Frequency of evaluation | **Every 1 Minute** |
1. On the **Create alert rule** blade, in the **Action group** section, click **Add action groups** and then click the **+ Create action group** button.
1. On the **Basics** tab of the **Create action group** blade, specify the following settings (leave others with their default values) and select **Next: Notifications >**:
| Settings | Value |
| --- | --- |
| Subscription | the name of the Azure subscription you are using in this lab |
| Resource group | **az104-11-rg1** |
| Action group name | **az104-11-ag1** |
| Display name | **az104-11-ag1** |
1. On the **Notifications** tab of the **Create action group** blade, in the **Notification type** drop-down list, select **Email/SMS/Push/Voice**. In the **Name** text box, type **admin email**. Click the **Edit details** (pencil) icon.
1. On the **Email/SMS/Push/Voice** blade, select the **Email** checkbox, type your email address in the **Email** textbox, leave others with their default values, click **OK**, back on the **Notifications** tab of the **Create action group** blade, select **Next: Actions >**.
1. On the **Actions** tab of the **Create action group** blade, review items available in the **Action type** drop-down list without making any changes and select **Review + create**.
1. On the **Review + create** tab of the **Create action group** blade, select **Create**.
1. Back on the **Create alert rule** blade, in the **Alert rule details** section, specify the following settings (leave others with their default values):
| Settings | Value |
| --- | --- |
| Alert rule name | **CPU Percentage above the test threshold** |
| Description | **CPU Percentage above the test threshold** |
| Severity | **Sev 3** |
| Enable rule upon creation | **Yes** |
1. Click **Create alert rule**.
>**Note**: It can take up to 10 minutes for a metric alert rule to become active.
1. In the Azure portal, search for and select **Virtual machines**, and on the **Virtual machines** blade, click **az104-11-vm0**.
1. On the **az104-11-vm0** blade, click **Connect**, in the drop-down menu, click **RDP**, on the **Connect with RDP** blade, click **Download RDP File** and follow the prompts to start the Remote Desktop session.
>**Note**: This step refers to connecting via Remote Desktop from a Windows computer. On a Mac, you can use Remote Desktop Client from the Mac App Store and on Linux computers you can use an open source RDP client software.
>**Note**: You can ignore any warning prompts when connecting to the target virtual machines.
1. When prompted, sign in by using the **Student** username and **Pa55w.rd1234** password.
1. Within the Remote Desktop session, click **Start**, expand the **Windows System** folder, and click **Command Prompt**.
1. From the Command Prompt, run the following to trigger increased CPU utilization on the **az104-11-vm0** Azure VM:
```sh
for /l %a in (0,0,1) do echo a
```
>**Note**: This will initiate the infinite loop that should increase the CPU utilization above the threshold of the newly created alert rule.
1. Leave the Remote Desktop session open and switch back to the browser window displaying the Azure portal on your lab computer.
1. In the Azure portal, navigate back to the **Monitor** blade and click **Alerts**.
1. Note the number of **Sev 3** alerts and then click the **Sev 3** row.
>**Note**: You might need to wait for a few minutes and click **Refresh**.
1. On the **All Alerts** blade, review generated alerts.
#### Task 7: Review Azure Log Analytics functionality
1. In the Azure portal, navigate back to the **Monitor** blade, click **Logs**.
>**Note**: You might need to click **Get Started** if this is the first time you access Log Analytics.
1. If necessary, click **Select scope**, on the **Select a scope** blade, select the **Recent** tab, select **az104-11-vm0**, and click **Apply**.
1. In the query window, paste the following query, click **Run**, and review the resulting chart:
```sh
// Virtual Machine available memory
// Chart the VM's available memory over the last hour.
InsightsMetrics
| where TimeGenerated > ago(1h)
| where Name == "AvailableMB"
| project TimeGenerated, Name, Val
| render timechart
```
1. Click **Queries** in the toolbar, on the **Queries** pane, locate the **Track VM availability** tile, click the **Run** command button in the tile, and review the results.
1. On the **New Query 1** tab, select the **Tables** header, and review the list of tables in the **Virtual machines** section.
>**Note**: The names of several tables correspond to the solutions you installed earlier in this lab.
1. Hover the mouse over the **VMComputer** entry and click the **See Preview data** icon.
1. If any data is available, in the **Update** pane, click **Use in editor**.
>**Note**: You might need to wait a few minutes before the update data becomes available.
#### Clean up resources
>**Note**: Remember to remove any newly created Azure resources that you no longer use. Removing unused resources ensures you will not see unexpected charges.
1. In the Azure portal, open the **PowerShell** session within the **Cloud Shell** pane.
1. List all resource groups created throughout the labs of this module by running the following command:
```powershell
Get-AzResourceGroup -Name 'az104-11*'
```
1. Delete all resource groups you created throughout the labs of this module by running the following command:
```powershell
Get-AzResourceGroup -Name 'az104-11*' | Remove-AzResourceGroup -Force -AsJob
```
>**Note**: The command executes asynchronously (as determined by the -AsJob parameter), so while you will be able to run another PowerShell command immediately afterwards within the same PowerShell session, it will take a few minutes before the resource groups are actually removed.
#### Review
In this lab, you have:
+ Provisioned the lab environment
+ Created and configured an Azure Log Analytics workspace and Azure Automation-based solutions
+ Reviewed default monitoring settings of Azure virtual machines
+ Configured Azure virtual machine diagnostic settings
+ Reviewed Azure Monitor functionality
+ Reviewed Azure Log Analytics functionality