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-json.md
+91-35Lines changed: 91 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
title: Create an Azure Image Builder template (preview)
3
3
description: Learn how to create a template to use with Azure Image Builder.
4
-
author: cynthn
5
-
ms.author: cynthn
6
-
ms.date: 07/31/2019
4
+
author: danis
5
+
ms.author: danis
6
+
ms.date: 01/23/2020
7
7
ms.topic: article
8
8
ms.service: virtual-machines-linux
9
9
manager: gwallace
@@ -22,11 +22,15 @@ This is the basic template format:
22
22
"tags": {
23
23
"<name": "<value>",
24
24
"<name>": "<value>"
25
-
},
25
+
}
26
26
"identity":{},
27
27
"dependsOn": [],
28
28
"properties": {
29
-
"buildTimeoutInMinutes": <minutes>,
29
+
"buildTimeoutInMinutes": <minutes>,
30
+
"vmProfile":
31
+
{
32
+
"vmSize": "<vmSize>"
33
+
},
30
34
"build": {},
31
35
"customize": {},
32
36
"distribute": {}
@@ -59,6 +63,24 @@ The location is the region where the custom image will be created. For the Image
59
63
```json
60
64
"location": "<region>",
61
65
```
66
+
## vmProfile
67
+
By default Image Builder will use a "Standard_D1_v2" build VM, you can override this, for example, if you want to customize an Image for a GPU VM, you need a GPU VM size. This is optional.
68
+
69
+
```json
70
+
{
71
+
"vmSize": "Standard_D1_v2"
72
+
},
73
+
```
74
+
75
+
## osDiskSizeGB
76
+
77
+
By default, Image Builder will not change the size of the image, it will use the size from the source image. You can adjust the size of the OS Disk (Win and Linux), note, do not go too small than the minimum required space required for the OS. This is optional, and a value of 0 means leave the same size as the source image. This is optional.
78
+
79
+
```json
80
+
{
81
+
"osDiskSizeGB": 100
82
+
},
83
+
```
62
84
63
85
## Tags
64
86
@@ -132,13 +154,7 @@ In the list of **Installers and Images for Red Hat Enterprise Linux Server**, yo
132
154
> The access tokens of the links are refreshed at frequent intervals, so every time you want to submit a template, you must check if the RH link address has changed.
133
155
134
156
### PlatformImage source
135
-
Azure Image Builder supports the following Azure Marketplace images:
136
-
* Ubuntu 18.04
137
-
* Ubuntu 16.04
138
-
* RHEL 7.6
139
-
* CentOS 7.6
140
-
* Windows 2016
141
-
* Windows 2019
157
+
Azure Image Builder supports Windows Server and client, and Linux Azure Marketplace images, see [here](https://docs.microsoft.com/azure/virtual-machines/windows/image-builder-overview#os-support) for the full list.
142
158
143
159
```json
144
160
"source": {
@@ -217,7 +233,8 @@ When using `customize`:
217
233
{
218
234
"type": "Shell",
219
235
"name": "<name>",
220
-
"scriptUri": "<path to script>"
236
+
"scriptUri": "<path to script>",
237
+
"sha256Checksum": "<sha256 checksum>"
221
238
},
222
239
{
223
240
"type": "Shell",
@@ -243,7 +260,8 @@ The shell customizer supports running shell scripts, these must be publicly acce
243
260
{
244
261
"type": "Shell",
245
262
"name": "<name>",
246
-
"scriptUri": "<link to script>"
263
+
"scriptUri": "<link to script>",
264
+
"sha256Checksum": "<sha256 checksum>"
247
265
},
248
266
],
249
267
"customize": [
@@ -263,7 +281,12 @@ Customize properties:
263
281
-**name** - name for tracking the customization
264
282
-**scriptUri** - URI to the location of the file
265
283
-**inline** - array of shell commands, separated by commas.
266
-
284
+
-**sha256Checksum** - Value of sha256 checksum of the file, you generate this locally, and then Image Builder will checksum and validate.
285
+
* To generate the sha256Checksum, using a terminal on Mac/Linux run: `sha256sum <fileName>`
286
+
287
+
288
+
For commands to run with super user privileges, they must be prefixed with `sudo`.
289
+
267
290
> [!NOTE]
268
291
> When running the shell customizer with RHEL ISO source, you need to ensure your first customization shell handles registering with a Red Hat entitlement server before any customization occurs. Once customization is complete, the script should unregister with the entitlement server.
269
292
@@ -272,12 +295,15 @@ The Restart customizer allows you to restart a Windows VM and wait for it come b
@@ -297,13 +323,16 @@ The shell customizer supports running PowerShell scripts and inline command, the
297
323
{
298
324
"type": "PowerShell",
299
325
"name": "<name>",
300
-
"scriptUri": "<path to script>"
326
+
"scriptUri": "<path to script>",
327
+
"runElevated": "<true false>",
328
+
"sha256Checksum": "<sha256 checksum>"
301
329
},
302
330
{
303
331
"type": "PowerShell",
304
332
"name": "<name>",
305
333
"inline": "<PowerShell syntax to run>",
306
-
"valid_exit_codes": "<exit code>"
334
+
"valid_exit_codes": "<exit code>",
335
+
"runElevated": "<true or false>"
307
336
}
308
337
],
309
338
```
@@ -316,6 +345,10 @@ Customize properties:
316
345
-**scriptUri** - URI to the location of the PowerShell script file.
317
346
-**inline** – Inline commands to be run, separated by commas.
318
347
-**valid_exit_codes** – Optional, valid codes that can be returned from the script/inline command, this will avoid reported failure of the script/inline command.
348
+
-**runElevated** – Optional, boolean, support for running commands and scripts with elevated permissions.
349
+
-**sha256Checksum** - Value of sha256 checksum of the file, you generate this locally, and then Image Builder will checksum and validate.
350
+
* To generate the sha256Checksum, using a PowerShell on Windows [Get-Hash](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-6)
351
+
319
352
320
353
### File customizer
321
354
@@ -327,7 +360,8 @@ The File customizer lets image builder download a file from a GitHub or Azure st
327
360
"type": "File",
328
361
"name": "<name>",
329
362
"sourceUri": "<source location>",
330
-
"destination": "<destination>"
363
+
"destination": "<destination>",
364
+
"sha256Checksum": "<sha256 checksum>"
331
365
}
332
366
]
333
367
```
@@ -395,8 +429,39 @@ Azure Image Builder supports three distribution targets:
395
429
396
430
You can distribute an image to both of the target types in the same configuration, please see [examples](https://github.com/danielsollondon/azvmimagebuilder/blob/7f3d8c01eb3bf960d8b6df20ecd5c244988d13b6/armTemplates/azplatform_image_deploy_sigmdi.json#L80).
397
431
398
-
Because you can have more than one target to distribute to, Image Builder maintains a state for every distribution target that can be accessed by querying the `runOutputName`. The `runOutputName` is an object you can query post distribution for information about that distribution. For example, you can query the location of the VHD, or regions where the image version was replicated to. This is a property of every distribution target. The `runOutputName` must be unique to each distribution target.
399
-
432
+
Because you can have more than one target to distribute to, Image Builder maintains a state for every distribution target that can be accessed by querying the `runOutputName`. The `runOutputName` is an object you can query post distribution for information about that distribution. For example, you can query the location of the VHD, or regions where the image version was replicated to, or SIG Image version created. This is a property of every distribution target. The `runOutputName` must be unique to each distribution target. Here is an example, this is querying a Shared Image Gallery distribution:
433
+
434
+
```bash
435
+
subscriptionID=<subcriptionID>
436
+
imageResourceGroup=<resourceGroup of image template>
0 commit comments