Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create + fetch details for Azure Service Principal using az cli (Unix/Linux)
# install homebrew (if on Windows install the msi)
/usr/bin/ruby -e "$(curl -fsSL"
brew update && brew install azure-cli
# brings up UI to login to Azure
az login
# creates service principal
az ad sp create-for-rbac
# fetches the subscription ID in which the sp was created
echo "Subscription ID:"
az account list --query "[?isDefault].id" -o tsv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment