You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux/image-builder-user-assigned-identity.md
+47-25Lines changed: 47 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,17 +38,20 @@ az feature show --namespace Microsoft.VirtualMachineImages --name VirtualMachine
38
38
39
39
Check your registration.
40
40
41
+
41
42
```azurecli-interactive
42
43
az provider show -n Microsoft.VirtualMachineImages | grep registrationState
43
-
44
+
az provider show -n Microsoft.KeyVault | grep registrationState
45
+
az provider show -n Microsoft.Compute | grep registrationState
44
46
az provider show -n Microsoft.Storage | grep registrationState
45
47
```
46
48
47
49
If they do not say registered, run the following:
48
50
49
51
```azurecli-interactive
50
52
az provider register -n Microsoft.VirtualMachineImages
51
-
53
+
az provider register -n Microsoft.Compute
54
+
az provider register -n Microsoft.KeyVault
52
55
az provider register -n Microsoft.Storage
53
56
```
54
57
@@ -86,6 +89,37 @@ az group create -n $imageResourceGroup -l $location
86
89
az group create -n $strResourceGroup -l $location
87
90
```
88
91
92
+
Create a user-assigned identity and set permissions on the resource group.
93
+
94
+
Image Builder will use the [user-identity](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-cli-windows-vm#user-assigned-managed-identity) provided to inject the image into the resource group. In this example, you will create an Azure role definition that has the granular actions to perform distributing the image. The role definition will then be assigned to the user-identity.
95
+
96
+
```console
97
+
# create user assigned identity for image builder to access the storage account where the script is located
98
+
idenityName=aibBuiUserId$(date +'%s')
99
+
az identity create -g $imageResourceGroup -n $idenityName
Give Image Builder permission to create resources in the image resource group. The `--assignee` value is the app registration ID for the Image Builder service.
Create the identity and assign permissions for the script storage account. For more information, see [User-Assigned Managed Identity](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/qs-configure-cli-windows-vm#user-assigned-managed-identity).
149
+
Give Image Builder permission to create resources in the image resource group. The `--assignee` value is the user-identity ID.
130
150
131
151
```azurecli-interactive
132
-
# Create the user assigned identity
133
-
identityName=aibBuiUserId$(date +'%s')
134
-
az identity create -g $imageResourceGroup -n $identityName
135
-
# assign the identity permissions to the storage account, so it can read the script blob
@@ -230,4 +252,4 @@ az group delete -n $strResourceGroup
230
252
231
253
## Next steps
232
254
233
-
If you have any trouble working with Azure Image Builder, see [Troubleshooting](https://github.com/danielsollondon/azvmimagebuilder/blob/master/troubleshootingaib.md?toc=%2fazure%2fvirtual-machines%context%2ftoc.json).
255
+
If you have any trouble working with Azure Image Builder, see [Troubleshooting](https://github.com/danielsollondon/azvmimagebuilder/blob/master/troubleshootingaib.md?toc=%2fazure%2fvirtual-machines%context%2ftoc.json).
0 commit comments