How to Login in Azure Portal through CLI

By Shekhar Gigras

We have two way to login in azure portal but before run any azure command in powershell, first install the azure module

Install Azure module Steps (Powershell)

  1. type "Get-Module PowerShellGet -list | Select-Object Name,version,path" command for check the install powershell modules
  2. If azure module not installed then run "Install-Module AzureRM -AllowClobber" command

Login In Azure Portal with two ways (Powershell)

  • First Way
    1. login through "Add-AzureRmAccount" then enter
    2. One popup window open then enter azure username and password

after login below information will be display in powershell window

  • Second Way

    • Create Profile file with command
Save-AzureRmContext -Profile (Add-AzureRmAccount) -Path <File Path with name>
examplae : test-profile-latest.json
    • After Create the profile json file then run below command before run any azure command. will never ask for login
$subscriptionid = ""
Import-AzureRmContext -Path test-profile-latest.json
Set-AzureRmContext -SubscriptionId $subscriptionid

Connect by Whatsapp

Posted in Azure on May 10, 2020


Comments

Please sign in to comment!