Created
June 28, 2017 09:33
-
-
Save RobsonAutomator/543722a6b7413ece3d7e5e0625b34a31 to your computer and use it in GitHub Desktop.
Login to Azure in automated way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ############################################################################# | |
# 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