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.md
+51-8Lines changed: 51 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ This article shows you how you can create a customized Linux image using the Azu
16
16
- Shell (inline) - runs specific commands. In this example, the inline commands include creating a directory and updating the OS.
17
17
- File - copies a [file from GitHub](https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html) into a directory on the VM.
18
18
19
+
19
20
We will be using a sample .json template to configure the image. The .json file we are using is here: [helloImageTemplateLinux.json](https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/0_Creating_a_Custom_Linux_Managed_Image/helloImageTemplateLinux.json).
20
21
21
22
> [!IMPORTANT]
@@ -52,7 +53,7 @@ az provider register -n Microsoft.VirtualMachineImages
52
53
az provider register -n Microsoft.Storage
53
54
```
54
55
55
-
## Create a resource group
56
+
## Setup Example Variables
56
57
57
58
We will be using some pieces of information repeatedly, so we will create some variables to store that information.
58
59
@@ -74,14 +75,17 @@ Create a variable for your subscription ID. You can get this using `az account s
74
75
subscriptionID=<Your subscription ID>
75
76
```
76
77
77
-
Create the resource group.
78
+
## Create the resource group.
79
+
This is used to store the image configuration template artifact and the image.
78
80
79
81
```azurecli-interactive
80
82
az group create -n $imageResourceGroup -l $location
81
83
```
82
84
85
+
## Set permissions on the resource group
86
+
Give Image Builder 'contributor' permission to create the image in the resource group. Without the proper permissions, the image build will fail.
83
87
84
-
Give Image Builder permission to create resources in that resource group. The `--assignee` value is the app registration ID for the Image Builder service.
88
+
The `--assignee` value is the app registration ID for the Image Builder service.
Download the example .json file and configure it with the variables you created.
99
+
A parameterized sample image configuration template has been created for you to use. Download the sample .json file and configure it with the variables you set earlier.
@@ -104,7 +108,19 @@ sed -i -e "s/<imageName>/$imageName/g" helloImageTemplateLinux.json
104
108
sed -i -e "s/<runOutputName>/$runOutputName/g" helloImageTemplateLinux.json
105
109
```
106
110
107
-
## Create the image
111
+
You can modify this example .json as needed. For example, you can increase the value of `buildTimeoutInMinutes` to allow for longer running builds. You can edit the file in Cloud Shell using `vi`.
112
+
113
+
```azurecli-interactive
114
+
vi helloImageTemplateLinux.json
115
+
```
116
+
117
+
> [!NOTE]
118
+
> For source image, you must always [specify a version](https://github.com/danielsollondon/azvmimagebuilder/blob/master/troubleshootingaib.md#image-version-failure), you cannot use `latest`.
119
+
>
120
+
> If you add or change the resource group where the image is being distributed, you need to make sure the [permissions are set for the resource group](#set-permissions-on-the-resource-group).
121
+
122
+
123
+
## Submit the image configuration
108
124
Submit the image configuration to the VM Image Builder service
109
125
110
126
```azurecli-interactive
@@ -116,8 +132,27 @@ az resource create \
116
132
-n helloImageTemplateLinux01
117
133
```
118
134
135
+
If it completes successfully, it will return a success message, and create an image builder configuration template artifact in the $imageResourceGroup. You can see the resource group in the portal if you enable 'Show hidden types'.
136
+
137
+
Also, in the background, Image Builder creates a staging resource group in your subcription. Image Builder uses the staging resource group for the image build. The name of the resource group will be in this format: `IT_<DestinationResourceGroup>_<TemplateName>`.
138
+
139
+
> [!IMPORTANT]
140
+
> Do not delete the staging resource group directly. If you delete the image template artifact, it will automatically delete the staging resource group. For more information, see the [Clean up](#clean-up) section at the end of this article.
141
+
142
+
If the service reports a failure during the image configuration template submission, see the [troubleshooting](https://github.com/danielsollondon/azvmimagebuilder/blob/master/troubleshootingaib.md#template-submission-errors--troubleshooting) steps. You will also need to delete the template before you retry submitting the build. To delete the template:
Wait until the build is complete. This can take about 15 minutes.
164
+
Wait until the build is complete, for this example, it can take 10-15 minutes.
165
+
166
+
If you encounter any errors, please review these [troubleshooting](https://github.com/danielsollondon/azvmimagebuilder/blob/master/troubleshootingaib.md#image-build-errors--troubleshooting) steps.
130
167
131
168
132
169
## Create the VM
@@ -174,14 +211,20 @@ For more detailed information about this .json file, see [Image builder template
0 commit comments