0% found this document useful (0 votes)
68 views

LAB 03c-Manage Azure Resources by Using Azure PowerShell

This document describes a lab to manage Azure resources using Azure PowerShell. The objectives are to start an Azure Cloud Shell PowerShell session, create a resource group and managed disk, and configure the disk. Students will create a resource group, 32GB standard storage disk, increase the disk size to 64GB, and change the storage type to premium. This teaches managing Azure resources with PowerShell in Cloud Shell.

Uploaded by

Sec About
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

LAB 03c-Manage Azure Resources by Using Azure PowerShell

This document describes a lab to manage Azure resources using Azure PowerShell. The objectives are to start an Azure Cloud Shell PowerShell session, create a resource group and managed disk, and configure the disk. Students will create a resource group, 32GB standard storage disk, increase the disk size to 64GB, and change the storage type to premium. This teaches managing Azure resources with PowerShell in Cloud Shell.

Uploaded by

Sec About
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

---

lab:
title: '03c - Manage Azure resources by Using Azure PowerShell'
module: 'Module 03 - Azure Administration'
---

# Lab 03c - Manage Azure resources by Using Azure PowerShell


# Student lab manual

## Lab scenario

Now that you explored the basic Azure administration capabilities associated with
provisioning resources and organizing them based on resource groups by using the
Azure portal and Azure Resource Manager templates, you need to carry out the
equivalent task by using Azure PowerShell. To avoid installing Azure PowerShell
modules, you will leverage PowerShell environment available in Azure Cloud Shell.

## Objectives

In this lab, you will:

+ Task 1: Start a PowerShell session in Azure Cloud Shell


+ Task 2: Create a resource group and an Azure managed disk by using Azure
PowerShell
+ Task 3: Configure the managed disk by using Azure PowerShell

## Estimated timing: 20 minutes

## Architecture diagram

![image](../media/lab03c.png)

## Instructions

### Exercise 1

#### Task 1: Start a PowerShell session in Azure Cloud Shell

In this task, you will open a PowerShell session in Cloud Shell.

1. In the 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. If prompted, click **Create storage**, and wait until the Azure Cloud Shell pane
is displayed.

1. Ensure **PowerShell** appears in the drop-down menu in the upper-left corner of


the Cloud Shell pane.

#### Task 2: Create a resource group and an Azure managed disk by using Azure
PowerShell

In this task, you will create a resource group and an Azure managed disk by using
Azure PowerShell session within Cloud Shell

1. To create a resource group in the same Azure region as the **az104-03b-rg1**


resource group you created in the previous lab, from the PowerShell session within
Cloud Shell, run the following:

```powershell
$location = (Get-AzResourceGroup -Name az104-03b-rg1).Location

$rgName = 'az104-03c-rg1'

New-AzResourceGroup -Name $rgName -Location $location


```
1. To retrieve properties of the newly created resource group, run the following:

```powershell
Get-AzResourceGroup -Name $rgName
```
1. To create a new managed disk with the same characteristics as those you created
in the previous labs of this module, run the following:

```powershell
$diskConfig = New-AzDiskConfig `
-Location $location `
-CreateOption Empty `
-DiskSizeGB 32 `
-Sku Standard_LRS

$diskName = 'az104-03c-disk1'

New-AzDisk `
-ResourceGroupName $rgName `
-DiskName $diskName `
-Disk $diskConfig
```

1. To retrieve properties of the newly created disk, run the following:

```powershell
Get-AzDisk -ResourceGroupName $rgName -Name $diskName
```

#### Task 3: Configure the managed disk by using Azure PowerShell

In this task, you will managing configuration of the Azure managed disk by using
Azure PowerShell session within Cloud Shell.

1. To increase the size of the Azure managed disk to **64 GB**, from the PowerShell
session within Cloud Shell, run the following:

```powershell
New-AzDiskUpdateConfig -DiskSizeGB 64 | Update-AzDisk -ResourceGroupName $rgName
-DiskName $diskName
```

1. To verify that the change took effect, run the following:

```powershell
Get-AzDisk -ResourceGroupName $rgName -Name $diskName
```

1. To verify the current SKU as **Standard_LRS**, run the following:

```powershell
(Get-AzDisk -ResourceGroupName $rgName -Name $diskName).Sku
```

1. To change the disk performance SKU to **Premium_LRS**, from the PowerShell


session within Cloud Shell, run the following:

```powershell
New-AzDiskUpdateConfig -Sku Premium_LRS | Update-AzDisk -ResourceGroupName
$rgName -DiskName $diskName
```

1. To verify that the change took effect, run the following:

```powershell
(Get-AzDisk -ResourceGroupName $rgName -Name $diskName).Sku
```

#### Clean up resources

>**Note**: Do not delete resources you deployed in this lab. You will reference
them in the next lab of this module.

#### Review

In this lab, you have:

- Started a PowerShell session in Azure Cloud Shell


- Created a resource group and an Azure managed disk by using Azure PowerShell
- Configured the managed disk by using Azure PowerShell

You might also like