Workshops Classroomnotes 16/Dec/2022

Tags in Azure

  • Benefits of using Tags in Azure:
    • Tag wise filtering of Azure Bills.
    • Filter resources using Tags.

Lab Setup

  • Azure CLI configured
az login
az group list

Activity 1: Create a Linux VM

  • Lets create a free tier linux vm.
  • Post creation we would want to apply tags
    • Environment: Dev
    • Project: azurelearning
    • Release: v1.1
    • Team: qtazure
  • Refer Here to know more about tags.
  • Scenario: You are asked to create tag for all the resources in a resource group
  • Refer Here for bash script
  • Scenario: Find all the resource groups in your subscription and tag them with Environment = Dev
  • Refer Here for scripts

Activity 2: Shutdown Vms to reduce costs

  • Get all the virtual machines with tag Enviroment = Dev and shutdown
  • get all the vms by resource type az resource list --resource-type and use jmes path filter Refer Here
  • shutdown => az vm deallocate
  • Refer Here for the script to deallocate the vms

Activity 3: Refine activity 2

  • Make changes in activity 2 to make it work for any resource type and any tag Name and value
  • Refer Here

Activity 4: Delete all the resource groups based on tag name and value

Glimpse of Automation

  • Overview
  • Complete the creation of automation account
  • Overview Blade
  • Navigate to run books

Activity 5: Get Virtual Machine Connectivity Details

  • Get the public ip of the virtual machine based on resource group
 az vm list -g 'workshop' -d --query "{ip: [0].publicIps, username: [0].osProfile.adminUsername}"

Exploring Powershell

  • To find any powershell cmdlet with format <verb>-<noun>
  • In Powershell the output is an object
  • Azure Powershell has a format <verb>-Az<noun>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner