Skip to content

Commit 9c178da

Browse files
authored
Merge pull request #266572 from pauljewellmsft/replaycheck-test
[ReplayCheck] Add tests for assigning roles via PS/CLI
2 parents e282696 + 8df9b38 commit 9c178da

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# %version 1
2+
contentPath: articles\storage\blobs\assign-azure-role-data-access.md
3+
4+
steps:
5+
- task: SetPlaceholder@1
6+
textToReplace: <email>
7+
replacementText:
8+
uid: cb105ef6
9+
- task: SetPlaceholder@1
10+
textToReplace: <subscription-id>
11+
replacementText:
12+
uid: e3ce9356
13+
- task: SetPlaceholder@1
14+
textToReplace: ab12cd34-ef56-ab12-cd34-ef56ab12cd34
15+
replacementText:
16+
uid: 2de8753c
17+
- task: SetPlaceholder@1
18+
textToReplace: <resource-group-name>
19+
replacementText: myResourceGroup
20+
uid: 542306be
21+
- task: SetPlaceholder@1
22+
textToReplace: <storage-account-name>
23+
replacementText:
24+
uid: "57011072"
25+
- task: SetPlaceholder@1
26+
textToReplace: <container-name>
27+
replacementText:
28+
uid: c0f2f9d5
29+
- task: RunCommand@1
30+
environment:
31+
type: azure-cloud-shell-pwsh
32+
outputValidationRules:
33+
- operator: contains
34+
value: 'RoleDefinitionName : Storage Blob Data Contributor'
35+
uid: fee1778
36+
- task: RunCommand@1
37+
environment:
38+
type: azure-cloud-shell-pwsh
39+
outputValidationRules:
40+
- operator: contains
41+
value: 'RoleDefinitionName : Storage Blob Data Reader'
42+
uid: 3361d580
43+
- task: RunCommand@1
44+
environment:
45+
type: az-cli
46+
outputValidationRules:
47+
- operator: contains
48+
value: '"roleDefinitionName": "Storage Blob Data Contributor"'
49+
uid: 60f1639b
50+
- task: RunCommand@1
51+
environment:
52+
type: az-cli
53+
outputValidationRules:
54+
- operator: contains
55+
value: '"roleDefinitionName": "Storage Blob Data Reader"'
56+
uid: 8cdad632

articles/storage/blobs/assign-azure-role-data-access.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ ms.custom: devx-track-azurepowershell, devx-track-azurecli
1515

1616
# Assign an Azure role for access to blob data
1717

18+
<!-- replaycheck-task id="cb105ef6" -->
19+
<!-- replaycheck-task id="e3ce9356" -->
20+
<!-- replaycheck-task id="2de8753c" -->
21+
<!-- replaycheck-task id="542306be" -->
22+
<!-- replaycheck-task id="57011072" -->
23+
<!-- replaycheck-task id="c0f2f9d5" -->
1824
Microsoft Entra authorizes access rights to secured resources through [Azure role-based access control (Azure RBAC)](../../role-based-access-control/overview.md). Azure Storage defines a set of Azure built-in roles that encompass common sets of permissions used to access blob data.
1925

2026
When an Azure role is assigned to a Microsoft Entra security principal, Azure grants access to those resources for that security principal. A Microsoft Entra security principal can be a user, a group, an application service principal, or a [managed identity for Azure resources](../../active-directory/managed-identities-azure-resources/overview.md).
@@ -96,6 +102,7 @@ To assign a role scoped to a storage account, specify a string containing the sc
96102

97103
The following example assigns the **Storage Blob Data Contributor** role to a user. The role assignment is scoped to level of the container. Make sure to replace the sample values and the placeholder values in brackets (`<>`) with your own values:
98104

105+
<!-- replaycheck-task id="fee1778" -->
99106
```powershell
100107
New-AzRoleAssignment -SignInName <email> `
101108
-RoleDefinitionName "Storage Blob Data Contributor" `
@@ -104,6 +111,7 @@ New-AzRoleAssignment -SignInName <email> `
104111

105112
The following example assigns the **Storage Blob Data Reader** role to a user by specifying the object ID. The role assignment is scoped to the level of the storage account. Make sure to replace the sample values and the placeholder values in brackets (`<>`) with your own values:
106113

114+
<!-- replaycheck-task id="3361d580" -->
107115
```powershell
108116
New-AzRoleAssignment -ObjectID "ab12cd34-ef56-ab12-cd34-ef56ab12cd34" `
109117
-RoleDefinitionName "Storage Blob Data Reader" `
@@ -138,6 +146,7 @@ To assign a role scoped to a container, specify a string containing the scope of
138146

139147
The following example assigns the **Storage Blob Data Contributor** role to a user. The role assignment is scoped to the level of the container. Make sure to replace the sample values and the placeholder values in brackets (`<>`) with your own values:
140148

149+
<!-- replaycheck-task id="60f1639b" -->
141150
```azurecli-interactive
142151
az role assignment create \
143152
--role "Storage Blob Data Contributor" \
@@ -147,7 +156,7 @@ az role assignment create \
147156

148157
The following example assigns the **Storage Blob Data Reader** role to a user by specifying the object ID. To learn more about the `--assignee-object-id` and `--assignee-principal-type` parameters, see [az role assignment](/cli/azure/role/assignment). In this example, the role assignment is scoped to the level of the storage account. Make sure to replace the sample values and the placeholder values in brackets (`<>`) with your own values:
149158

150-
<!-- replaycheck-task id="66526dae" -->
159+
<!-- replaycheck-task id="8cdad632" -->
151160
```azurecli-interactive
152161
az role assignment create \
153162
--role "Storage Blob Data Reader" \

0 commit comments

Comments
 (0)