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.
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.
- Sign in to the Azure Portal.
- Search for Resource groups in the top search bar and select it.
- Click + Create.
- For Subscription, select your active subscription.
- For Resource group, enter
brainybee-lab-rg. - For Region, select
(US) East US(or a region close to you). - 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.
- Open the Cloud Shell by clicking the
>_icon in the top navigation bar of the Portal. - Ensure the environment is set to Bash in the dropdown menu on the top-left of the shell.
- Run the following command (Replace
<UNIQUE_ID>with 5 random numbers to ensure global uniqueness):
az storage account create \
--name "mystorage<UNIQUE_ID>" \
--resource-group brainybee-lab-rg \
--location eastus \
--sku Standard_LRS▶Console alternative
Navigate to
. 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.
- In the same Cloud Shell window, switch the dropdown from Bash to PowerShell.
- Confirm the switch if prompted.
- Run the following command to list the resources in your group:
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.
- In the Portal search bar, type Deploy a custom template and select it.
- Select Build your own template in the editor.
- Replace the default JSON with this simple code for an Azure Log Analytics Workspace:
{
"$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" }
}
]
}- Click Save, select your
brainybee-lab-rg, and click Review + create -> Create.
Checkpoints
| Verification Step | Expected Result |
|---|---|
| Check Portal Resource Group list | brainybee-lab-rg appears in the list. |
Run az storage account show in CLI | JSON output returns storage details. |
| Check Resource Group "Resources" tab | Should show 1 Storage Account and 1 Log Analytics Workspace. |
Troubleshooting
| Problem | Possible Cause | Solution |
|---|---|---|
| Storage Account name error | Storage names must be unique globally across all of Azure. | Add more unique numbers/letters to the name. |
| Cloud Shell is hanging | Network connectivity or session timeout. | Refresh the browser tab or click the "Restart" icon in Cloud Shell. |
| Authorization failed | Insufficient 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:
az group delete --name brainybee-lab-rg --yes --no-waitAlternatively, in the Azure Portal:
- Go to Resource groups.
- Select
brainybee-lab-rg. - Click Delete resource group.
- Type the name to confirm and click Delete.