Let's Share

My personal place to share knowledge about Sitecore, Powershell, Amazon Web Services and .NET

How to setup automatic login to Azure account

posted by Robert Senktas   | 27-06-2017

My posts about Sitecore on Azure

Some time ago I started an adventure with Sitecore Azure Toolkit. Here is a list of my posts about Siteore on Azure:
1. Sitecore on Azure - X0 instance costs 2. How to use shared access signatures (SAS) in an automated way during Sitecore deployment with Azure Toolkit.


Automatic-Azure-login Some time ago I started an adventure with Sitecore Azure Toolkit. The first annoying thing I came across was logging in to Azure login. In Polish we call it 'upierdliwa rzecz'. I decided to use my Sitecore Automation Module, actually a part of module functionality called a Simple Credential Store.
The first simple thing that I have to do is create a storage and save this storage to CSV file. File content is encrypted and can be decryped only on my computer. Below there is a Powershell snippet:

Import-Module sitecore-automation
New-StoredCredential -Key "AzureLogins"
Export-CredentialStore -Path (Join-Path "C:\SitecoreInstall\Azure" -ChildPath 'azure.csv')

Well, and that's it. We just need to read credentials and pass data to Login-AzureRmAccount funtion:

Import-Module sitecore-automation	
Import-CredentialStore -Path (Join-Path "C:\SitecoreInstall\Azure" -ChildPath 'azure.csv')
Login-AzureRmAccount -Credential (Get-StoredPSCredential -Key "AzureLogin")

Now, you are logged to Azure account and you are able to do whatever you want.

Sitecore Powershell Azure
This is a personal blog. All opinions here are my own opinions and do not represent my employer’s view in anyway.

Sitecore Automation Module