Skip to content

Commit 70d516b

Browse files
Modify RBAC roles for Azure Blob Storage endpoints
Updated RBAC role assignments for Azure Blob Storage endpoints to include 'Storage Account Contributor' along with 'Storage Blob Data Owner'.
1 parent 32fa08f commit 70d516b

1 file changed

Lines changed: 96 additions & 2 deletions

File tree

articles/storage-mover/azure-to-azure-migration.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,57 @@ az storage-mover endpoint create-for-storage-container \
204204

205205
### [Azure portal](#tab/portal)
206206

207-
When you create an Azure Blob Storage source or target endpoint through the Azure portal, the **Storage Blob Data Owner** RBAC role is automatically assigned to the system-assigned managed identity of the endpoint. No other steps are required.
207+
When you create an Azure Blob Storage source or target endpoint through the Azure portal, the **Storage Account Contributor** and **Storage Blob Data Owner** RBAC role is automatically assigned to the system-assigned managed identity of the endpoint. No other steps are required.
208208

209209

210210
### [Azure PowerShell](#tab/powershell)
211211

212-
Assign the **Storage Blob Data Owner** RBAC role on the source and target blob storage container to the system-assigned managed identity of the target endpoint. First, retrieve the principal ID of the target endpoint's managed identity by using the `Get-AzStorageMoverAzStorageContainerEndpoint` command:
212+
Assign the **Storage Account Contributor** RBAC role on the source and target blob storage accounts to the system-assigned managed identity of the target endpoint.
213+
First, retrieve the principal ID of the target endpoint's managed identity by using the `Get-AzStorageMoverAzStorageContainerEndpoint` command:
214+
215+
```powershell
216+
$endpoint = Get-AzStorageMoverAzStorageContainerEndpoint `
217+
-ResourceGroupName <String> `
218+
-StorageMoverName <String> `
219+
-Name <String>
220+
221+
$principalId = $endpoint.Identity.PrincipalId
222+
```
223+
224+
Then, use the `New-AzRoleAssignment` command to assign the role:
225+
226+
```powershell
227+
New-AzRoleAssignment `
228+
-ObjectId <String> `
229+
-RoleDefinitionName "Storage Account Contributor" `
230+
-Scope <String>
231+
```
232+
233+
**Parameters:**
234+
235+
- **ObjectId**: The object ID (principal ID) of the system-assigned managed identity of the target endpoint.
236+
- **RoleDefinitionName**: Set to **"Storage Account Contributor"**.
237+
- **Scope**: The Azure resource ID of the source or target blob storage account.
238+
239+
**Example:**
240+
241+
```powershell
242+
# Get the source or target endpoint
243+
$endpoint = Get-AzStorageMoverEndpoint `
244+
-ResourceGroupName "c2c-pvt-ecy-rg" `
245+
-StorageMoverName "myStorageMover" `
246+
-Name "my-blob-endpoint"
247+
248+
# Assign the RBAC role using the principal ID
249+
New-AzRoleAssignment `
250+
-ObjectId $endpoint.Identity.PrincipalId `
251+
-RoleDefinitionName "Storage Account Contributor" `
252+
-Scope "/subscriptions/<subscription-id>/resourceGroups/c2c-pvt-ecy-rg/providers/Microsoft.Storage/storageAccounts/mystorageaccount"
253+
```
254+
255+
256+
Assign the **Storage Blob Data Owner** RBAC role on the source and target blob storage container to the system-assigned managed identity of the target endpoint.
257+
First, retrieve the principal ID of the target endpoint's managed identity by using the `Get-AzStorageMoverAzStorageContainerEndpoint` command:
213258

214259
```powershell
215260
$endpoint = Get-AzStorageMoverAzStorageContainerEndpoint `
@@ -253,6 +298,55 @@ New-AzRoleAssignment `
253298

254299
### [Azure CLI](#tab/CLI)
255300

301+
Assign the **Storage Account Contributor** RBAC role on the source and target blob storage accounts to the system-assigned managed identity of the target endpoint.
302+
First, retrieve the principal ID of the source or target endpoint's managed identity by using the `az storage-mover endpoint show` command:
303+
304+
```bash
305+
az storage-mover endpoint show \
306+
--resource-group <String> \
307+
--storage-mover-name <String> \
308+
--name <String> \
309+
--query identity.principalId \
310+
--output tsv
311+
```
312+
313+
Then, use the `az role assignment create` command to assign the role:
314+
315+
```bash
316+
az role assignment create \
317+
--assignee-object-id <String> \
318+
--assignee-principal-type ServicePrincipal \
319+
--role "Storage Account Contributor" \
320+
--scope <String>
321+
```
322+
323+
**Parameters:**
324+
325+
- **assignee-object-id**: The object ID (principal ID) of the system-assigned managed identity of the target endpoint.
326+
- **assignee-principal-type**: Set to **"ServicePrincipal"**.
327+
- **role**: Set to **"Storage Account Contributor"**.
328+
- **scope**: The Azure resource ID of the source or target blob storage account.
329+
330+
**Example:**
331+
332+
```Bash
333+
# Get the principal ID
334+
PRINCIPAL_ID=$(az storage-mover endpoint show \
335+
--resource-group "c2c-pvt-ecy-rg" \
336+
--storage-mover-name "myStorageMover" \
337+
--name "my-blob-endpoint" \
338+
--query identity.principalId \
339+
--output tsv)
340+
341+
# Assign the RBAC role using the principal ID
342+
az role assignment create \
343+
--assignee-object-id $PRINCIPAL_ID \
344+
--assignee-principal-type ServicePrincipal \
345+
--role "Storage Account Contributor" \
346+
--scope "/subscriptions/<subscription-id>/resourceGroups/c2c-pvt-ecy-rg/providers/Microsoft.Storage/storageAccounts/mystorageaccount"
347+
```
348+
349+
Assign the **Storage Blob Data Owner** RBAC role on the source and target blob storage container to the system-assigned managed identity of the target endpoint.
256350
First, retrieve the principal ID of the source or target endpoint's managed identity by using the `az storage-mover endpoint show` command:
257351

258352
```bash

0 commit comments

Comments
 (0)