Last active
March 26, 2021 11:08
-
-
Save kunduso/580b0c13875f1d841f252fe482d5db41 to your computer and use it in GitHub Desktop.
azure cli commands to create a service principal
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
# az ad sp create-for-rbac --name "$(Service-Principal-Name)" --role "Contributor" --scope "/subscriptions/$(SubscriptionNumber)" | |
az ad sp create-for-rbac --name "Terraform-User-March-2021" --role "Contributor" --scope "/subscriptions/$(SubscriptionID)" | |
# I am replacing the tenant and subscription value with variable for security reasons | |
# Output from the commandline console: | |
Changing "Terraform-User-March-2021" to a valid URI of "http://Terraform-User-March-2021", which is the required format used for service principal names | |
Creating 'Contributor' role assignment under scope '/subscriptions/$(SubscriptionID)' | |
The output includes credentials that you must protect. Be sure that you do not include these credentials in your code or check the credentials into your source control. For more information, see https://aka.ms/azadsp-cli | |
{ | |
"appId": "3a08aff0-9708-455b-855c-1747fcf7434d", | |
"displayName": "Terraform-User-March-2021", | |
"name": "http://Terraform-User-March-2021", | |
"password": "OJ-6-uMZt4a1v~ZjLl3EdzogUnkzn9GZga", | |
"tenant": "$(SubscriptionTenantID)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment