Last active
July 5, 2022 15:26
-
-
Save codycodes/08ee7e28c59e808b918cc7554d839ff8 to your computer and use it in GitHub Desktop.
Create + fetch details for Azure Service Principal using az cli (Unix/Linux)
This file contains 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
#!/bin/bash | |
# install homebrew (if on Windows install the msi) | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
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