I’ve been working in Azure for a while and find it quite frustrating that every time I launched up PowerShell ISE I needed to first log into Azure to get things started. I knew back in the classic days you could download your Azure profile and load that into PowerShell to save you having to log in ever time. I’ve never tried this with the new Azure Resource Manager though.
This post will show you the simple process of downloading your Azure profile and configuring PowerShell to automatically load it on start up.
Open up PowerShell ISE and execute the following commands:
Login-AzureRmAccount Save-AzureRmProfile -Path “c:\AzureProfile\azureprofile.json”
This will download your Azure login details into a JSON file.
The next step is to configure your PowerShell profile to automatically load this up when it starts.
In the PowerShell ISE run:
This will load up your PowerShell profile in notepad (if you’ve never done this before it will probably be empty). Now enter the scripts to load your Azure profile details.
Select-AzureRmProfile -Path “c:\AzureProfile\azureprofile.json” | Out-Null Write-Host "Successfully logged in using saved profile file" -ForegroundColor Green Get-AzureRmSubscription –SubscriptionName "your subscription name" | Select-AzureRmSubscription | Out-Null Write-Host "Set Azure Subscription for session complete" -ForegroundColor Green
Save and close the notepad file.
Now, whenever you load up the PowerShell ISE you will automatically be logged into Azure! Awesome!