Hands-On Lab864 words

Lab: Managing and Deploying Azure Resources with Portal, CLI, and ARM

Describe features and tools for managing and deploying Azure resources

Lab: Managing and Deploying Azure Resources with Portal, CLI, and ARM

This hands-on lab introduces the primary tools used to interact with Microsoft Azure. You will explore the Azure Portal, use the Azure Cloud Shell (supporting both Bash/CLI and PowerShell), and understand how the Azure Resource Manager (ARM) provides a unified management layer.

[!IMPORTANT] This lab requires an active Azure Subscription. If you do not have one, you can create a free account at azure.microsoft.com/free.

Prerequisites

  • Azure Subscription: Access to an Azure Tenant with "Contributor" or "Owner" permissions on a subscription.
  • Cloud Shell Initialization: If this is your first time using Cloud Shell, you will need to create a storage account for it (Azure will prompt you for this).
  • Browser: A modern web browser (Edge, Chrome, or Firefox).

Learning Objectives

  • Navigate the Azure Portal to manage resource groups.
  • Execute commands using the Azure CLI and Azure PowerShell via Cloud Shell.
  • Deploy a basic resource using an Azure Resource Manager (ARM) Template.
  • Understand the role of Azure Resource Manager as the central management layer.

Architecture Overview

All tools—the Portal, CLI, and PowerShell—interact with a single endpoint: the Azure Resource Manager (ARM) API. This ensures consistency regardless of which tool you use.

Loading Diagram...

Resource Hierarchy Visual

The following diagram represents the logical hierarchy of Azure management levels:

\begin{tikzpicture}[node distance=1.5cm, every node/.style={draw, rectangle, rounded corners, fill=blue!10, text width=4cm, align=center}] \node (MG) {Management Group}; \node (SUB) [below of=MG] {Subscription}; \node (RG) [below of=SUB] {Resource Group}; \node (RES) [below of=RG] {Resources (VMs, DBs, etc.)};

\draw [->, thick] (MG) -- (SUB); \draw [->, thick] (SUB) -- (RG); \draw [->, thick] (RG) -- (RES); \end{tikzpicture}

Step-by-Step Instructions

Step 1: Create a Resource Group via Azure Portal

Resource groups are logical containers for your Azure resources.

  1. Sign in to the Azure Portal.
  2. Search for Resource groups in the top search bar and select it.
  3. Click + Create.
  4. For Subscription, select your active subscription.
  5. For Resource group, enter brainybee-lab-rg.
  6. For Region, select (US) East US (or a region close to you).
  7. Click Review + create, then Create.

[!TIP] Always use a consistent naming convention for resource groups to make them easier to find and manage.

Step 2: Create a Storage Account via Azure CLI

Now we will use the command-line interface to add a resource to our new group.

  1. Open the Cloud Shell by clicking the >_ icon in the top navigation bar of the Portal.
  2. Ensure the environment is set to Bash in the dropdown menu on the top-left of the shell.
  3. Run the following command (Replace <UNIQUE_ID> with 5 random numbers to ensure global uniqueness):
bash
az storage account create \ --name "mystorage<UNIQUE_ID>" \ --resource-group brainybee-lab-rg \ --location eastus \ --sku Standard_LRS
Console alternative

Navigate to

Storage accounts
Create

. Select your Resource Group, provide a name, and keep the default Standard LRS settings.

Step 3: Verify Resources with Azure PowerShell

Let's switch tools to see how they provide the same view of your infrastructure.

  1. In the same Cloud Shell window, switch the dropdown from Bash to PowerShell.
  2. Confirm the switch if prompted.
  3. Run the following command to list the resources in your group:
powershell
Get-AzResource -ResourceGroupName "brainybee-lab-rg" | Select-Object Name, ResourceType

[!NOTE] Notice that the Storage Account you created via the CLI in Step 2 is visible here in PowerShell.

Step 4: Infrastructure as Code (ARM Template)

ARM Templates allow you to define your infrastructure in JSON format for repeatable deployments.

  1. In the Portal search bar, type Deploy a custom template and select it.
  2. Select Build your own template in the editor.
  3. Replace the default JSON with this simple code for an Azure Log Analytics Workspace:
json
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "resources": [ { "type": "Microsoft.OperationalInsights/workspaces", "apiVersion": "2020-08-01", "name": "lab-workspace", "location": "eastus", "sku": { "name": "PerGB2018" } } ] }
  1. Click Save, select your brainybee-lab-rg, and click Review + create -> Create.

Checkpoints

Verification StepExpected Result
Check Portal Resource Group listbrainybee-lab-rg appears in the list.
Run az storage account show in CLIJSON output returns storage details.
Check Resource Group "Resources" tabShould show 1 Storage Account and 1 Log Analytics Workspace.

Troubleshooting

ProblemPossible CauseSolution
Storage Account name errorStorage names must be unique globally across all of Azure.Add more unique numbers/letters to the name.
Cloud Shell is hangingNetwork connectivity or session timeout.Refresh the browser tab or click the "Restart" icon in Cloud Shell.
Authorization failedInsufficient permissions on the subscription.Ensure you have 'Owner' or 'Contributor' role assigned.

Clean-Up / Teardown

[!WARNING] Failure to delete these resources may result in minor consumption charges. Always clean up after labs.

To delete everything created in this lab, run the following command in either Bash or PowerShell:

bash
az group delete --name brainybee-lab-rg --yes --no-wait

Alternatively, in the Azure Portal:

  1. Go to Resource groups.
  2. Select brainybee-lab-rg.
  3. Click Delete resource group.
  4. Type the name to confirm and click Delete.

Ready to study Microsoft Azure Fundamentals (AZ-900)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free