Can I Login without prompt in Azure

0 votes

Actually, I tried the below commands inorder to get a no-prompt login scenario, but every time, i am getting login popup. 
I also tried to use a certificate, but didn't work too. Even when tried to use tenat ID. 
 Can someone suggest me how to get a faster no-login prompt experience?

Login-AzureRmAccount -SubscriptionId XXXX -TenantId XXXX

Add-AzureRmAccount -Tenant "XXXX" -SubscriptionId "XXXX"

Login-AzureRmAccount -TenantId XXX

May 9, 2018 in Azure by null_void
• 3,220 points
6,249 views

2 answers to this question.

0 votes

There is a simple way of acheiving this. You can try the below steps:

> Login to your azure account with command: Login-AzureRmAccount
> Save the context in a Json file using command: Save-AzureRmContext -Path "E:\AzureProfile.json"
> Now, you can login without prompt using command: Import-AzureRmContext -Path "E:\AzureProfile.json"

Hope it helped!

If you need to know more about Azure, then you should join Azure training course online today.

Thank you!!

answered May 10, 2018 by club_seesharp
• 3,450 points
0 votes

You can use -Credential parameter, and DPAPI to login.

First, run the following PowerShell once to store a secured password for your account.

Read-Host "Enter Password" -AsSecureString | ConvertTo-SecureString `
-AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\Password.txt"

And then, you can use the following script to login.

# The azure account here must not be a Live ID.
$username = "<your Azure account>"
$SecurePassword = Get-Content "C:\Password.txt" | ConvertTo-SecureString
$cred = new-object -typename System.Management.Automation.PSCredential `
     -argumentlist $username, $SecurePassword

Login-AzureRmAccount -Credential $cred

An other way would be using Service Principal. First, you should follow the article to create a Service Principal

And then, use the following script to login.

$clientID = "<the client id of your AD Application>"
$key = "<the key of your AD Application>"
$SecurePassword = $key | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential `
     -argumentlist $clientID, $SecurePassword
$tenantID = "<the tenant id of your subscription>"

Add-AzureRmAccount -Credential $cred -TenantId $tenantID -ServicePrincipal
answered Aug 17, 2018 by Priyaj
• 58,090 points

Related Questions In Azure

0 votes
1 answer
0 votes
1 answer

Can I use an appsettings.json file in Azure Functions?

Only environment variables are supported for app ...READ MORE

answered Apr 24, 2019 in Azure by Prerna
• 1,960 points
4,637 views
0 votes
1 answer

Can I provision an Azure service without using the portal?

Yes, It is possible to provision the ...READ MORE

answered Dec 27, 2019 in Azure by Sirajul
• 59,230 points
464 views
0 votes
1 answer
0 votes
1 answer

How can I schedule a pipeline to run in azure datafactory?

You can use the scheduler trigger or ...READ MORE

answered Jan 2, 2020 in Azure by Sirajul
• 59,230 points
651 views
0 votes
1 answer

Where i can see the monitoring data in Azure? Can we get that data locally in SQL or NoSQL?

You can check the logs for the ...READ MORE

answered Jun 30, 2020 in Azure by Shivangi Namgyal
423 views
0 votes
4 answers

How can I rename a SQL Azure database?

This command serves the purpose ALTER DATABASE [oldname] ...READ MORE

answered Nov 30, 2018 in Azure by Abhinav
1,912 views
+1 vote
1 answer

Can I rename a Azure Storage Blob?

Though the approach I'm about to share ...READ MORE

answered May 11, 2018 in Azure by club_seesharp
• 3,450 points
10,327 views
0 votes
1 answer

How can I remove/hide/disable excessive HTTP response headers in Azure/IIS7 without having to use UrlScan?

MSDN published an article on how to ...READ MORE

answered May 22, 2018 in Azure by club_seesharp
• 3,450 points
3,433 views
0 votes
2 answers

How can I view the deployed files in Azure?

In Visual Studio, in the window "Server ...READ MORE

answered Aug 21, 2018 in Azure by Priyaj
• 58,090 points
4,412 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP