Azure Classroom Series – 17/Oct/2021

Deploying Workloads on Azure using CLI/Powershell

  • So far, we have been working on Azure VM or VMSS using Portal, In typical enterprise scenarios we are expected to create/maintain deployments of our application in an automated fashion.
  • Azure Has 3 popular interfaces
    • Portal
    • Command line:
      • Azure CLI
      • Azure Powershell
    • From Code:
      • Azure SDK
  • Lets start exploring command line.

Azure CLI

  • Azure CLI is a set of commands to create/manage azure resources.
  • Azure Commands will be in the form of
az service [sub service ] [sub service ] <action> <parameters>
  • The sample azure cli command ignoring parameters or arguments
az group list
az sql server create 
  • Install Azure CLI: Refer Here

  • Understanding JSON: Refer Here

  • Refer Here for the Azure CLI documentation.

  • Learning Activity 1: Using Azure CLI from cloud shell

    • Navigate to Azure Portal and launch cloud shell and switch to bash Preview Preview Preview Preview
  • Learning Activity 2: Create a resource group clidemo in eastus

    • Documentation Navigation Preview Preview Preview
    • Command: az group create --location 'eastus' --name 'clidemo' Preview
  • Learning Activity 3: delete the resource group created clidemo

    • Refer Here for the documentation
    • command: az group delete --name 'clidemo'
  • Learning Activity 4: Now lets try to create a Linux Virtual Machine and install apache inside the vm using cli

    • Steps:
      • Create a resource group
      • Create a virutal machine
        • find the documentation Preview
        • Using the documentation Refer Here try to come up with a command to create a ubuntu linux vm where we provide username, password, image
        • Waiting till 8:08 for you to come up with a command.

      • Open 80 port for web traffic
      • connect to virtual machine
      • Install webserver
      • Test webserver from browser/curl
      • Clean up resources
    • Productivity Tips:
      • Install the Azure CLI Tools extension to visual studio code Preview
      • Create a file with extension .azcli
  • To find the correct vm image we need to know

    • Publishers -> Offers -> Images -> Versions
    az vm image list-publishers --location eastus --output table | less
    
    • Publisher => canonical
    az vm image list-offers --location eastus --publisher canonical --output table
    
    • Offer => UbuntuServer
    az vm image list --publisher canonical --offer 'UbuntuServer' --all --output table
    
  • Now create a azure vm with the command Preview Preview

  • Commands

az group create --location 'eastus' --name 'linuxvm'
az vm create --resource-group 'linuxvm' --name 'qtwebserver' \
    --admin-username 'qtdevops' --admin-password learning@123 \
    --image 'Canonical:UbuntuServer:18.04-LTS:latest' \
    --size 'Standard_B1s'

  • Exercise: Create a windows 2016 server with size standard_b1s

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube