Automatically logon to the Azure portal through PowerShell and a browser

A while ago a customer contacted me with the request to write a script that programmatically logged on to the Azure portal, through a web-browser.

First, you’ll need some credentials. In this case I’ve created them quick and dirty but I recommend  you don’t put credentials plain text in a script 😉
Next up would be actually logging on:

After some rigorous testing I found out that it works… once. After that a cookie is saved and the script will fail.
So a quick workaround in my case was to delete the cookie(s) andthe script ran again 🙂

P.S. Yes, I know… Internet Explorer, and through a COM port. If you can improve by using another browser, please do so and post underneath this post! I would love to learn from your code 😀

2 comments

  1. JeffOps says:

    […] I posted about ‘Automatically logon to the Azure portal through PowerShell and a browser‘. Well, this works for Office365 too! Simlpy replace the URL in the post with […]

  2. […] I posted about ‘Automatically logon to the Azure portal through PowerShell and a browser‘. Well, this works for Office365 too! Simlpy replace the URL in the post with […]

Leave a Reply

Your email address will not be published. Required fields are marked *