Skip to content

Instantly share code, notes, and snippets.

@RobsonAutomator
Created June 28, 2017 09:33
Show Gist options
  • Save RobsonAutomator/543722a6b7413ece3d7e5e0625b34a31 to your computer and use it in GitHub Desktop.
Save RobsonAutomator/543722a6b7413ece3d7e5e0625b34a31 to your computer and use it in GitHub Desktop.
Login to Azure in automated way
# #############################################################################
# Login to Azure
#
# AUTHOR: Robert Senktas
# BLOG: http://lets-share.senktas.net/2017/06/sitecore-on-azure-login.html
#
# COMMENT:
# #############################################################################
#Requires –Modules sitecore-automation
#Import-Module sitecore-automation
$credentialsPath = (Join-Path $env:USERPROFILE -ChildPath 'azure.csv')
Import-CredentialStore -Path $credentialsPath
if( -not (Test-StoredCredential -Key 'AzureLogin') )
{
New-StoredCredential -Key "AzureLogin" -Message "Please enter credentials to Azure account"
Export-CredentialStore -Path $credentialsPath
}
Login-AzureRmAccount -Credential (Get-StoredPSCredential -Key "AzureLogin")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment