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)
- type "Get-Module PowerShellGet -list | Select-Object Name,version,path" command for check the install powershell modules
- If azure module not installed then run "Install-Module AzureRM -AllowClobber" command
Login In Azure Portal with two ways (Powershell)
- First Way
- login through "Add-AzureRmAccount" then enter
- 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