Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
custom role details
Browse files Browse the repository at this point in the history
  • Loading branch information
mithunshanbhag committed Apr 12, 2023
1 parent 2400234 commit 266116c
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions docs/deployment-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,35 @@ You will need following to get started:
* Make a note of the JSON output from above step (especially the `clientId`, `clientSecret`, `subscriptionId` and `tenantId` properties). These will be required later.
* You'll notice a warning in the output: `Option '--sdk-auth' has been deprecated and will be removed in a future release`. This is [a known issue, without workarounds, but can be safely ignored](https://github.com/Azure/azure-cli/issues/20743).

5. If for some reason, you do not have permissions to add the service principal in the `Owner` role on the subscription, then you can create a custom role with `Microsoft.Authorization/roleAssignments/write` permissions (on subscription scope) and assign this to the service principal as follows.

If using bash:

```bash
az role definition create --role-definition '{
"Name": "ContosoTraders Write Role Assignments",
"Description": "Perform Role Assignments",
"Actions": ["Microsoft.Authorization/roleAssignments/write"],
"AssignableScopes": ["/subscriptions/<AZURE-SUBSCRIPTION-ID>"]
}'
```

If using PowerShell or cmd shell, you can run `az role definition create --role-definition ./custom-role.json`. Note that you need to first create a file called `custom-role.json` containing the following snippet.

```json
{
"Name": "ContosoTraders Write Role Assignments",
"Description": "Perform Role Assignments",
"Actions": ["Microsoft.Authorization/roleAssignments/write"],
"AssignableScopes": ["/subscriptions/<AZURE-SUBSCRIPTION-ID>"]
}
```

>
> Replace `<AZURE-SUBSCRIPTION-ID>` in snippets above with your Azure subscription ID.
>
5. If for some reason, you do not have permissions to add the service principal in the `Owner` role on the subscription, then you can create a custom role and assign it to the service principal as follows (remember to replace `<AZURE-SUBSCRIPTION-ID>` in snippets below with your Azure subscription ID).

1. If using bash:

```bash
az role definition create --role-definition '{
"Name": "ContosoTraders Write Role Assignments",
"Description": "Perform Role Assignments",
"Actions": ["Microsoft.Authorization/roleAssignments/write"],
"AssignableScopes": ["/subscriptions/<AZURE-SUBSCRIPTION-ID>"]
}'
```

2. If using PowerShell or cmd shell, you can run `az role definition create --role-definition ./custom-role.json`. Note that you need to first create a file called `custom-role.json` containing the following snippet.

```json
{
"Name": "ContosoTraders Write Role Assignments",
"Description": "Perform Role Assignments",
"Actions": ["Microsoft.Authorization/roleAssignments/write"],
"AssignableScopes": ["/subscriptions/<AZURE-SUBSCRIPTION-ID>"]
}
```

3. Finally create the service principal and assign it to the custom role:

```bash
`az ad sp create-for-rbac -n contosotraders-sp --role "ContosoTraders Write Role Assignments" --scopes /subscriptions/<AZURE-SUBSCRIPTION-ID> --sdk-auth`
```

## Prepare your GitHub Account

Expand Down

0 comments on commit 266116c

Please sign in to comment.