Skip to content

Instantly share code, notes, and snippets.

@oliverlabs
Last active March 10, 2023 09:25
Show Gist options
  • Save oliverlabs/c7b199860321e09d3637ad4df9b375e1 to your computer and use it in GitHub Desktop.
Save oliverlabs/c7b199860321e09d3637ad4df9b375e1 to your computer and use it in GitHub Desktop.
Create a Service Principal in Bash using Azure CLI
# export MSYS_NO_PATHCONV=1
# Replace <subscription_id> with your Subscription ID.
# You can replace the <service-principal-name> with a custom name for your environment or omit the parameter entirely.
# If you omit the parameter, the service principal name is generated based on the current date and time.
# FOR AN OWNER ROLE:
# az ad sp create-for-rbac --scopes "/subscriptions/<subscription_id>" --role "Owner" --name <service_principal_name>
# FOR A CONTRIBUTOR ROLE:
az ad sp create-for-rbac --name <service_principal_name> --role Contributor --scopes /subscriptions/<subscription_id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment