Skip to content

Commit 260d04a

Browse files
authored
Merge pull request #200469 from rolyon/rolyon-rbac-cli-object-id
[Azure RBAC] CLI object id updates
2 parents 283d704 + f062233 commit 260d04a

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

articles/role-based-access-control/role-assignments-cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: karenhoran
77
ms.service: role-based-access-control
88
ms.topic: how-to
99
ms.workload: identity
10-
ms.date: 09/28/2020
10+
ms.date: 06/03/2022
1111
ms.author: rolyon
1212
ms.custom: contperf-fy21q1, devx-track-azurecli
1313
---
@@ -35,23 +35,23 @@ You can assign a role to a user, group, service principal, or managed identity.
3535
For an Azure AD user, get the user principal name, such as *patlong\@contoso.com* or the user object ID. To get the object ID, you can use [az ad user show](/cli/azure/ad/user#az-ad-user-show).
3636

3737
```azurecli
38-
az ad user show --id "{principalName}" --query "objectId" --output tsv
38+
az ad user show --id "{principalName}" --query "id" --output tsv
3939
```
4040

4141
**Group**
4242

4343
For an Azure AD group, you need the group object ID. To get the object ID, you can use [az ad group show](/cli/azure/ad/group#az-ad-group-show) or [az ad group list](/cli/azure/ad/group#az-ad-group-list).
4444

4545
```azurecli
46-
az ad group show --group "{groupName}" --query "objectId" --output tsv
46+
az ad group show --group "{groupName}" --query "id" --output tsv
4747
```
4848

4949
**Service principal**
5050

5151
For an Azure AD service principal (identity used by an application), you need the service principal object ID. To get the object ID, you can use [az ad sp list](/cli/azure/ad/sp#az-ad-sp-list). For a service principal, use the object ID and **not** the application ID.
5252

5353
```azurecli
54-
az ad sp list --all --query "[].{displayName:displayName, objectId:objectId}" --output tsv
54+
az ad sp list --all --query "[].{displayName:displayName, id:id}" --output tsv
5555
az ad sp list --display-name "{displayName}"
5656
```
5757

articles/role-based-access-control/role-assignments-list-cli.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.service: role-based-access-control
1010
ms.topic: how-to
1111
ms.tgt_pltfrm: na
1212
ms.workload: identity
13-
ms.date: 10/30/2020
13+
ms.date: 06/03/2022
1414
ms.author: rolyon
1515
ms.reviewer: bagovind
1616
---
@@ -161,13 +161,13 @@ az role assignment list --scope /providers/Microsoft.Management/managementGroups
161161
To get the principal ID of a user-assigned managed identity, you can use [az ad sp list](/cli/azure/ad/sp#az-ad-sp-list) or [az identity list](/cli/azure/identity#az-identity-list).
162162

163163
```azurecli
164-
az ad sp list --display-name "{name}" --query [].objectId --output tsv
164+
az ad sp list --display-name "{name}" --query [].id --output tsv
165165
```
166166
167167
To get the principal ID of a system-assigned managed identity, you can use [az ad sp list](/cli/azure/ad/sp#az-ad-sp-list).
168168
169169
```azurecli
170-
az ad sp list --display-name "{vmname}" --query [].objectId --output tsv
170+
az ad sp list --display-name "{vmname}" --query [].id --output tsv
171171
```
172172
173173
1. To list the role assignments, use [az role assignment list](/cli/azure/role/assignment#az-role-assignment-list).

articles/role-based-access-control/role-assignments-template.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: karenhoran
88
ms.service: role-based-access-control
99
ms.topic: how-to
1010
ms.workload: identity
11-
ms.date: 01/21/2021
11+
ms.date: 06/03/2022
1212
ms.author: rolyon
1313
ms.custom: devx-track-azurepowershell, devx-track-azurecli
1414
ms.devlang: azurecli
@@ -34,7 +34,7 @@ $objectid = (Get-AzADUser -DisplayName "{name}").id
3434
```
3535

3636
```azurecli
37-
objectid=$(az ad user show --id "{email}" --query objectId --output tsv)
37+
objectid=$(az ad user show --id "{email}" --query id --output tsv)
3838
```
3939

4040
### Group
@@ -46,7 +46,7 @@ $objectid = (Get-AzADGroup -DisplayName "{name}").id
4646
```
4747

4848
```azurecli
49-
objectid=$(az ad group show --group "{name}" --query objectId --output tsv)
49+
objectid=$(az ad group show --group "{name}" --query id --output tsv)
5050
```
5151

5252
### Managed identities
@@ -58,7 +58,7 @@ $objectid = (Get-AzADServicePrincipal -DisplayName <Azure resource name>).id
5858
```
5959

6060
```azurecli
61-
objectid=$(az ad sp list --display-name <Azure resource name> --query [].objectId --output tsv)
61+
objectid=$(az ad sp list --display-name <Azure resource name> --query [].id --output tsv)
6262
```
6363

6464
### Application
@@ -70,7 +70,7 @@ $objectid = (Get-AzADServicePrincipal -DisplayName "{name}").id
7070
```
7171

7272
```azurecli
73-
objectid=$(az ad sp list --display-name "{name}" --query [].objectId --output tsv)
73+
objectid=$(az ad sp list --display-name "{name}" --query [].id --output tsv)
7474
```
7575

7676
## Assign an Azure role

0 commit comments

Comments
 (0)