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
In this article, you learn how to use Azure VM Image Builder and the Azure CLI to create an image version in an [Azure Compute Gallery](../shared-image-galleries.md) (formerly Shared Image Gallery) and then distribute the image globally. You can also create an image version by using [Azure PowerShell](../windows/image-builder-gallery.md).
18
18
19
-
20
19
This article uses a sample JSON template to configure the image. The JSON file is at [helloImageTemplateforSIG.json](https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/1_Creating_a_Custom_Linux_Shared_Image_Gallery_Image/helloImageTemplateforSIG.json).
21
20
22
21
To distribute the image to an Azure Compute Gallery, the template uses [sharedImage](image-builder-json.md#distribute-sharedimage) as the value for the `distribute` section of the template.
23
22
24
-
25
23
## Register the features
24
+
26
25
To use VM Image Builder, you need to register the feature. Check your registration by running the following commands:
27
26
28
27
```azurecli-interactive
@@ -43,7 +42,7 @@ az provider register -n Microsoft.Storage
43
42
az provider register -n Microsoft.Network
44
43
```
45
44
46
-
## Set variables and permissions
45
+
## Set variables and permissions
47
46
48
47
Because you'll be using some pieces of information repeatedly, create some variables to store that information.
49
48
@@ -80,7 +79,7 @@ az group create -n $sigResourceGroup -l $location
80
79
81
80
VM Image Builder uses the provided [user-identity](../../active-directory/managed-identities-azure-resources/qs-configure-cli-windows-vm.md#user-assigned-managed-identity) to inject the image into an Azure Compute Gallery. In this example, you create an Azure role definition with specific actions for distributing the image. The role definition is then assigned to the user identity.
82
81
83
-
```bash
82
+
```azurecli-interactive
84
83
# Create user-assigned identity for VM Image Builder to access the storage account where the script is stored
85
84
identityName=aibBuiUserId$(date +'%s')
86
85
az identity create -g $sigResourceGroup -n $identityName
To use VM Image Builder with Azure Compute Gallery, you need to have an existing gallery and image definition. VM Image Builder doesn't create the gallery and image definition for you.
@@ -139,7 +137,6 @@ az sig image-definition create \
139
137
--os-type Linux
140
138
```
141
139
142
-
143
140
## Download and configure the JSON file
144
141
145
142
Download the JSON template and configure it with your variables:
@@ -183,7 +180,6 @@ az resource invoke-action \
183
180
184
181
It can take a few moments to create the image and replicate it to both regions. Wait until this part is finished before you move on to create a VM.
185
182
186
-
187
183
## Create the VM
188
184
189
185
Create the VM from the image version that was created by VM Image Builder.
@@ -261,7 +257,7 @@ When you're deleting gallery resources, you need delete all the image versions b
0 commit comments