Skip to content

Commit bce3e5d

Browse files
author
Jill Grant
authored
Merge pull request #234180 from divargas-msft/patch-5
[Doc-a-thon] Updating image-builder-gallery.md
2 parents 535620f + 2b4a44a commit bce3e5d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

articles/virtual-machines/linux/image-builder-gallery.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to use the Azure Image Builder, and the Azure CLI, to cre
44
author: kof-f
55
ms.author: kofiforson
66
ms.reviewer: cynthn
7-
ms.date: 03/02/2021
7+
ms.date: 04/11/2023
88
ms.topic: how-to
99
ms.service: virtual-machines
1010
ms.subservice: image-builder
@@ -17,12 +17,10 @@ ms.custom: devx-track-azurecli
1717

1818
This article shows you how you can use the Azure Image Builder, and the Azure CLI, to create an image version in an [Azure Compute Gallery](../shared-image-galleries.md) (formerly known as Shared Image Gallery), then distribute the image globally. You can also do this using [Azure PowerShell](../windows/image-builder-gallery.md).
1919

20-
2120
We will be using a sample .json template to configure the image. The .json file we are using is here: [helloImageTemplateforSIG.json](https://github.com/azure/azvmimagebuilder/blob/master/quickquickstarts/1_Creating_a_Custom_Linux_Shared_Image_Gallery_Image/helloImageTemplateforSIG.json).
2221

2322
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.
2423

25-
2624
## Register the features
2725

2826
To use Azure Image Builder, you need to register the feature.
@@ -47,7 +45,7 @@ az provider register -n Microsoft.Storage
4745
az provider register -n Microsoft.Network
4846
```
4947

50-
## Set variables and permissions
48+
## Set variables and permissions
5149

5250
We will be using some pieces of information repeatedly, so we will create some variables to store that information.
5351

@@ -81,9 +79,10 @@ az group create -n $sigResourceGroup -l $location
8179
```
8280

8381
## Create a user-assigned identity and set permissions on the resource group
82+
8483
Image Builder will use the [user-identity](../../active-directory/managed-identities-azure-resources/qs-configure-cli-windows-vm.md#user-assigned-managed-identity) provided to inject the image into the Azure Compute Gallery. In this example, you will create an Azure role definition that has the granular actions to perform distributing the image to the gallery. The role definition will then be assigned to the user-identity.
8584

86-
```bash
85+
```azurecli-interactive
8786
# create user assigned identity for image builder to access the storage account where the script is located
8887
identityName=aibBuiUserId$(date +'%s')
8988
az identity create -g $sigResourceGroup -n $identityName
@@ -114,7 +113,6 @@ az role assignment create \
114113
--scope /subscriptions/$subscriptionID/resourceGroups/$sigResourceGroup
115114
```
116115

117-
118116
## Create an image definition and gallery
119117

120118
To use Image Builder with an Azure Compute Gallery, you need to have an existing gallery and image definition. Image Builder will not create the gallery and image definition for you.
@@ -140,7 +138,6 @@ az sig image-definition create \
140138
--os-type Linux
141139
```
142140

143-
144141
## Download and configure the .json
145142

146143
Download the .json template and configure it with your variables.
@@ -184,7 +181,6 @@ az resource invoke-action \
184181

185182
Creating the image and replicating it to both regions can take a while. Wait until this part is finished before moving on to creating a VM.
186183

187-
188184
## Create the VM
189185

190186
Create a VM from the image version that was created by Azure Image Builder.
@@ -219,7 +215,6 @@ You should see the image was customized with a *Message of the Day* as soon as y
219215

220216
If you want to now try re-customizing the image version to create a new version of the same image, skip the next steps and go on to [Use Azure Image Builder to create another image version](image-builder-gallery-update-image-version.md).
221217

222-
223218
This will delete the image that was created, along with all of the other resource files. Make sure you are finished with this deployment before deleting the resources.
224219

225220
When deleting gallery resources, you need delete all of the image versions before you can delete the image definition used to create them. To delete a gallery, you first need to have deleted all of the image definitions in the gallery.
@@ -234,6 +229,7 @@ az resource delete \
234229
```
235230

236231
Delete permissions assignments, roles and identity
232+
237233
```azurecli-interactive
238234
az role assignment delete \
239235
--assignee $imgBuilderCliId \
@@ -259,8 +255,7 @@ az sig image-version delete \
259255
--gallery-name $sigName \
260256
--gallery-image-definition $imageDefName \
261257
--subscription $subscriptionID
262-
```
263-
258+
```
264259

265260
Delete the image definition.
266261

0 commit comments

Comments
 (0)