Azure Power Shell 

Powershell Az module

  • If you have multiple subscriptions and to select any one of the subscriptions using the following command :
                    Select-AzSubscription -SubscriptionObject "Azure for Students"
                
  • Selecting a specific resource group based on location by using the filtering technique in PowerShell
                        Get-AzResourceGroup | Where-Object {$_.Location -eq "australiaeast"}
                    
  • Creating a new Virtual Machine
                        New-AzVM -ResourceGroupName demogroup -Location 'North Europe' -name 'vmdemo' -Image CentOS
                    

    A prompt will pop-up asking you to provide username  and password for the VM that will be created
  • Creating multiple storages in azure

                    $rg = "demogroup" 
foreach ($i in 1..10) {
New-AzStorageAccount `
-ResourceGroupName $rg `
-Name demogroupstorage$i `
-SkuName Standard_LRS `
-Location 'North Europe' `
-AsJob
}

Here we are passing the resource group name “demogroup” through the rg variable into the loop

Related posts

Leave a Comment