Azure Classroom Series – 23/Feb/2020

Azure CLI

  • Command Line interface of Azure
  • Azure CLi can be installed on
    • Linux
    • Mac
    • windows
  • Download the Azure CLI. Refer Here for installation docs
  • AZURE CLI needs to be explicitly authenticated post installation

Why Azure CLI

  • Azure CLI is used to automate the activities, because we can create a script for the infrastructure on azure and run it whenever we need it or where ever we need it.

Authentication and Usage

  • To authenticate to azure
az login
  • Azure CLI usage and basic syntax
az <service> <resource> <subresource>  <action> <paramters>

# example resource groups
az group list
az group create --name forcli  --location 'Central US'
az group delete --name forcli

Scenario: Create a Resource Group and Virtual network with 3 subnets

  • Navigate to here Preview
  • In this we would like create a resource group first. Now search for a section which is about resource groups Preview
  • Now open create section Preview
  • From this example our command looks like
az group create --location 'Central Us' --name 'fromcli'
az network vnet create --name fromcli --resource-group 'fromcli' --address-prefixes '192.168.0.0/16' --location 'Central Us' --subnet-name 'subnet1' --subnet-prefixes '192.168.0.0/24'
  • Now lets add two more subnets
az network vnet subnet create --address-prefixes '192.168.1.0/24' --name 'subnet2' --resource-group 'fromcli' --vnet-name 'fromcli'

az network vnet subnet create --address-prefixes '192.168.2.0/24' --name 'subnet3' --resource-group 'fromcli' --vnet-name 'fromcli'

Leave a Reply

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

About learningthoughtsadmin