Skip to content

Instantly share code, notes, and snippets.

@gravejester

gravejester/AzureAuth4.sh

Last active Jun 13, 2017
Embed
What would you like to do?
#!/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