Skip to content

Instantly share code, notes, and snippets.

@gravejester
Last active June 13, 2017 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gravejester/0bc73d1ca65d2203aeef02c6a46bc2ec to your computer and use it in GitHub Desktop.
Save gravejester/0bc73d1ca65d2203aeef02c6a46bc2ec to your computer and use it in GitHub Desktop.
#!/bin/bash
SP_NAME=$1
SP_PW=$2
SP_TENANT=$3
# Authenticate to Azure
if [ -z "$SP_NAME" ] || [ -z "$SP_PW" ] || [ -z "$SP_TENANT" ]
then
LOGIN_RESULT=$(az login)
else
LOGIN_RESULT=$(az login --username $SP_NAME --password $SP_PW --tenant $SP_TENANT --service-principal 2> /dev/null)
fi
if [ -z "$LOGIN_RESULT" ]
then
echo "Failed to authenticate to Azure!"
else
echo "Authenticated to Azure"
fi
# YOUR CODE GOES HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment