Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
SP with resource group level scope example (#3077)
Browse files Browse the repository at this point in the history
  • Loading branch information
billpratt authored and Cecile Robert-Michon committed May 24, 2018
1 parent 6a02217 commit d65c809
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions docs/serviceprincipal.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ There are several ways to create a Service Principal in Azure Active Directory:

* **With the [Azure CLI](https://github.com/Azure/azure-cli)**

```shell
az login
az account set --subscription="${SUBSCRIPTION_ID}"
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"
```
* Subscription level scope
```shell
az login
az account set --subscription="${SUBSCRIPTION_ID}"
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}"
```
* Resource group level scope
```shell
az login
az account set --subscription="${SUBSCRIPTION_ID}"
az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP_NAME}"
```

This will output your `appId`, `password`, `name`, and `tenant`. The `name` or `appId` may be used for the `servicePrincipalProfile.clientId` and the `password` is used for `servicePrincipalProfile.secret`.

Expand Down

0 comments on commit d65c809

Please sign in to comment.