Microsoft.VirtualMachineImages imageTemplates 2019-02-01-preview
Bicep resource definition
The imageTemplates resource type can be deployed to:
- Resource groups - See resource group deployment commands
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.VirtualMachineImages/imageTemplates resource, add the following Bicep to your template.
resource symbolicname 'Microsoft.VirtualMachineImages/imageTemplates@2019-02-01-preview' = {
name: 'string'
location: 'string'
tags: {
tagName1: 'tagValue1'
tagName2: 'tagValue2'
}
properties: {
customize: [
{
name: 'string'
type: 'string'
// For remaining properties, see ImageTemplateCustomizer objects
}
]
distribute: [
{
artifactTags: {}
runOutputName: 'string'
type: 'string'
// For remaining properties, see ImageTemplateDistributor objects
}
]
source: {
type: 'string'
// For remaining properties, see ImageTemplateSource objects
}
}
}
ImageTemplateCustomizer objects
Set the type property to specify the type of object.
For PowerShell, use:
type: 'PowerShell'
inline: [
'string'
]
script: 'string'
validExitCodes: [
int
]
For Shell, use:
type: 'Shell'
inline: [
'string'
]
script: 'string'
For WindowsRestart, use:
type: 'WindowsRestart'
restartCheckCommand: 'string'
restartCommand: 'string'
restartTimeout: 'string'
ImageTemplateDistributor objects
Set the type property to specify the type of object.
For ManagedImage, use:
type: 'ManagedImage'
imageId: 'string'
location: 'string'
For SharedImage, use:
type: 'SharedImage'
galleryImageId: 'string'
replicationRegions: [
'string'
]
For VHD, use:
type: 'VHD'
ImageTemplateSource objects
Set the type property to specify the type of object.
For ISO, use:
type: 'ISO'
sha256Checksum: 'string'
sourceURI: 'string'
For ManagedImage, use:
type: 'ManagedImage'
imageId: 'string'
For PlatformImage, use:
type: 'PlatformImage'
offer: 'string'
publisher: 'string'
sku: 'string'
version: 'string'
Property values
imageTemplates
Name | Description | Value |
---|---|---|
name | The resource name | string (required) |
location | Resource location | string (required) |
tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
properties | ImageTemplateProperties |
ImageTemplateProperties
Name | Description | Value |
---|---|---|
customize | Specifies the properties used to describe the customization steps of the image, like Image source etc | ImageTemplateCustomizer[] |
distribute | The distribution targets where the image output needs to go to. | ImageTemplateDistributor[] (required) |
source | Specifies the properties used to describe the source image. | ImageTemplateSource (required) |
ImageTemplateCustomizer
Name | Description | Value |
---|---|---|
name | Friendly Name to provide context on what this customization step does | string |
type | Set the object type | PowerShell Shell WindowsRestart (required) |
ImageTemplatePowerShellCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'PowerShell' (required) |
inline | Array of PowerShell commands to execute | string[] |
script | The PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
validExitCodes | Valid exit codes for the PowerShell script. [Default: 0] | int[] |
ImageTemplateShellCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'Shell' (required) |
inline | Array of shell commands to execute | string[] |
script | The shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
ImageTemplateRestartCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'WindowsRestart' (required) |
restartCheckCommand | Command to check if restart succeeded [Default: ''] | string |
restartCommand | Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] | string |
restartTimeout | Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] | string |
ImageTemplateDistributor
Name | Description | Value |
---|---|---|
artifactTags | Tags that will be applied to the artifact once it has been created/updated by the distributor. | object |
runOutputName | The name to be used for the associated RunOutput. | string (required) |
type | Set the object type | ManagedImage SharedImage VHD (required) |
ImageTemplateManagedImageDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | 'ManagedImage' (required) |
imageId | Resource Id of the Managed Disk Image | string (required) |
location | Azure location for the image, should match if image already exists | string (required) |
ImageTemplateSharedImageDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | 'SharedImage' (required) |
galleryImageId | Resource Id of the Shared Image Gallery image | string (required) |
replicationRegions | string[] (required) |
ImageTemplateVhdDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | 'VHD' (required) |
ImageTemplateSource
Name | Description | Value |
---|---|---|
type | Set the object type | ISO ManagedImage PlatformImage (required) |
ImageTemplateIsoSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | 'ISO' (required) |
sha256Checksum | SHA256 Checksum of the ISO image. | string (required) |
sourceURI | URI to get the ISO image. This URI has to be accessible to the resource provider at the time of the image template creation. | string (required) |
ImageTemplateManagedImageSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | 'ManagedImage' (required) |
imageId | ARM resource id of the managed image in customer subscription | string (required) |
ImageTemplatePlatformImageSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | 'PlatformImage' (required) |
offer | Image offer from the Azure Gallery Images. | string |
publisher | Image Publisher in Azure Gallery Images. | string |
sku | Image sku from the Azure Gallery Images. | string |
version | Image version from the Azure Gallery Images. | string |
Quickstart templates
The following quickstart templates deploy this resource type.
Template | Description |
---|---|
Azure Image Builder with Azure Windows Baseline |
Creates an Azure Image Builder environment and builds a Windows Server image with the latest Windows Updates and Azure Windows Baseline applied. |
Configure Dev Box service |
This template would create all Dev Box admin resources as per Dev Box quick start guide. You can view all resources created, or directly go to DevPortal.microsoft.com to create your first Dev Box. |
ARM template resource definition
The imageTemplates resource type can be deployed to:
- Resource groups - See resource group deployment commands
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.VirtualMachineImages/imageTemplates resource, add the following JSON to your template.
{
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"apiVersion": "2019-02-01-preview",
"name": "string",
"location": "string",
"tags": {
"tagName1": "tagValue1",
"tagName2": "tagValue2"
},
"properties": {
"customize": [
{
"name": "string",
"type": "string"
// For remaining properties, see ImageTemplateCustomizer objects
}
],
"distribute": [
{
"artifactTags": {},
"runOutputName": "string",
"type": "string"
// For remaining properties, see ImageTemplateDistributor objects
}
],
"source": {
"type": "string"
// For remaining properties, see ImageTemplateSource objects
}
}
}
ImageTemplateCustomizer objects
Set the type property to specify the type of object.
For PowerShell, use:
"type": "PowerShell",
"inline": [ "string" ],
"script": "string",
"validExitCodes": [ "int" ]
For Shell, use:
"type": "Shell",
"inline": [ "string" ],
"script": "string"
For WindowsRestart, use:
"type": "WindowsRestart",
"restartCheckCommand": "string",
"restartCommand": "string",
"restartTimeout": "string"
ImageTemplateDistributor objects
Set the type property to specify the type of object.
For ManagedImage, use:
"type": "ManagedImage",
"imageId": "string",
"location": "string"
For SharedImage, use:
"type": "SharedImage",
"galleryImageId": "string",
"replicationRegions": [ "string" ]
For VHD, use:
"type": "VHD"
ImageTemplateSource objects
Set the type property to specify the type of object.
For ISO, use:
"type": "ISO",
"sha256Checksum": "string",
"sourceURI": "string"
For ManagedImage, use:
"type": "ManagedImage",
"imageId": "string"
For PlatformImage, use:
"type": "PlatformImage",
"offer": "string",
"publisher": "string",
"sku": "string",
"version": "string"
Property values
imageTemplates
Name | Description | Value |
---|---|---|
type | The resource type | 'Microsoft.VirtualMachineImages/imageTemplates' |
apiVersion | The resource api version | '2019-02-01-preview' |
name | The resource name | string (required) |
location | Resource location | string (required) |
tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
properties | ImageTemplateProperties |
ImageTemplateProperties
Name | Description | Value |
---|---|---|
customize | Specifies the properties used to describe the customization steps of the image, like Image source etc | ImageTemplateCustomizer[] |
distribute | The distribution targets where the image output needs to go to. | ImageTemplateDistributor[] (required) |
source | Specifies the properties used to describe the source image. | ImageTemplateSource (required) |
ImageTemplateCustomizer
Name | Description | Value |
---|---|---|
name | Friendly Name to provide context on what this customization step does | string |
type | Set the object type | PowerShell Shell WindowsRestart (required) |
ImageTemplatePowerShellCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'PowerShell' (required) |
inline | Array of PowerShell commands to execute | string[] |
script | The PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
validExitCodes | Valid exit codes for the PowerShell script. [Default: 0] | int[] |
ImageTemplateShellCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'Shell' (required) |
inline | Array of shell commands to execute | string[] |
script | The shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
ImageTemplateRestartCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'WindowsRestart' (required) |
restartCheckCommand | Command to check if restart succeeded [Default: ''] | string |
restartCommand | Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] | string |
restartTimeout | Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] | string |
ImageTemplateDistributor
Name | Description | Value |
---|---|---|
artifactTags | Tags that will be applied to the artifact once it has been created/updated by the distributor. | object |
runOutputName | The name to be used for the associated RunOutput. | string (required) |
type | Set the object type | ManagedImage SharedImage VHD (required) |
ImageTemplateManagedImageDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | 'ManagedImage' (required) |
imageId | Resource Id of the Managed Disk Image | string (required) |
location | Azure location for the image, should match if image already exists | string (required) |
ImageTemplateSharedImageDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | 'SharedImage' (required) |
galleryImageId | Resource Id of the Shared Image Gallery image | string (required) |
replicationRegions | string[] (required) |
ImageTemplateVhdDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | 'VHD' (required) |
ImageTemplateSource
Name | Description | Value |
---|---|---|
type | Set the object type | ISO ManagedImage PlatformImage (required) |
ImageTemplateIsoSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | 'ISO' (required) |
sha256Checksum | SHA256 Checksum of the ISO image. | string (required) |
sourceURI | URI to get the ISO image. This URI has to be accessible to the resource provider at the time of the image template creation. | string (required) |
ImageTemplateManagedImageSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | 'ManagedImage' (required) |
imageId | ARM resource id of the managed image in customer subscription | string (required) |
ImageTemplatePlatformImageSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | 'PlatformImage' (required) |
offer | Image offer from the Azure Gallery Images. | string |
publisher | Image Publisher in Azure Gallery Images. | string |
sku | Image sku from the Azure Gallery Images. | string |
version | Image version from the Azure Gallery Images. | string |
Quickstart templates
The following quickstart templates deploy this resource type.
Template | Description |
---|---|
Azure Image Builder with Azure Windows Baseline |
Creates an Azure Image Builder environment and builds a Windows Server image with the latest Windows Updates and Azure Windows Baseline applied. |
Configure Dev Box service |
This template would create all Dev Box admin resources as per Dev Box quick start guide. You can view all resources created, or directly go to DevPortal.microsoft.com to create your first Dev Box. |
Terraform (AzAPI provider) resource definition
The imageTemplates resource type can be deployed to:
- Resource groups
For a list of changed properties in each API version, see change log.
Resource format
To create a Microsoft.VirtualMachineImages/imageTemplates resource, add the following Terraform to your template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.VirtualMachineImages/imageTemplates@2019-02-01-preview"
name = "string"
location = "string"
parent_id = "string"
tags = {
tagName1 = "tagValue1"
tagName2 = "tagValue2"
}
body = jsonencode({
properties = {
customize = [
{
name = "string"
type = "string"
// For remaining properties, see ImageTemplateCustomizer objects
}
]
distribute = [
{
artifactTags = {}
runOutputName = "string"
type = "string"
// For remaining properties, see ImageTemplateDistributor objects
}
]
source = {
type = "string"
// For remaining properties, see ImageTemplateSource objects
}
}
})
}
ImageTemplateCustomizer objects
Set the type property to specify the type of object.
For PowerShell, use:
type = "PowerShell"
inline = [
"string"
]
script = "string"
validExitCodes = [
int
]
For Shell, use:
type = "Shell"
inline = [
"string"
]
script = "string"
For WindowsRestart, use:
type = "WindowsRestart"
restartCheckCommand = "string"
restartCommand = "string"
restartTimeout = "string"
ImageTemplateDistributor objects
Set the type property to specify the type of object.
For ManagedImage, use:
type = "ManagedImage"
imageId = "string"
location = "string"
For SharedImage, use:
type = "SharedImage"
galleryImageId = "string"
replicationRegions = [
"string"
]
For VHD, use:
type = "VHD"
ImageTemplateSource objects
Set the type property to specify the type of object.
For ISO, use:
type = "ISO"
sha256Checksum = "string"
sourceURI = "string"
For ManagedImage, use:
type = "ManagedImage"
imageId = "string"
For PlatformImage, use:
type = "PlatformImage"
offer = "string"
publisher = "string"
sku = "string"
version = "string"
Property values
imageTemplates
Name | Description | Value |
---|---|---|
type | The resource type | "Microsoft.VirtualMachineImages/imageTemplates@2019-02-01-preview" |
name | The resource name | string (required) |
location | Resource location | string (required) |
parent_id | To deploy to a resource group, use the ID of that resource group. | string (required) |
tags | Resource tags | Dictionary of tag names and values. |
properties | ImageTemplateProperties |
ImageTemplateProperties
Name | Description | Value |
---|---|---|
customize | Specifies the properties used to describe the customization steps of the image, like Image source etc | ImageTemplateCustomizer[] |
distribute | The distribution targets where the image output needs to go to. | ImageTemplateDistributor[] (required) |
source | Specifies the properties used to describe the source image. | ImageTemplateSource (required) |
ImageTemplateCustomizer
Name | Description | Value |
---|---|---|
name | Friendly Name to provide context on what this customization step does | string |
type | Set the object type | PowerShell Shell WindowsRestart (required) |
ImageTemplatePowerShellCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | "PowerShell" (required) |
inline | Array of PowerShell commands to execute | string[] |
script | The PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
validExitCodes | Valid exit codes for the PowerShell script. [Default: 0] | int[] |
ImageTemplateShellCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | "Shell" (required) |
inline | Array of shell commands to execute | string[] |
script | The shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
ImageTemplateRestartCustomizer
Name | Description | Value |
---|---|---|
type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | "WindowsRestart" (required) |
restartCheckCommand | Command to check if restart succeeded [Default: ''] | string |
restartCommand | Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] | string |
restartTimeout | Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] | string |
ImageTemplateDistributor
Name | Description | Value |
---|---|---|
artifactTags | Tags that will be applied to the artifact once it has been created/updated by the distributor. | object |
runOutputName | The name to be used for the associated RunOutput. | string (required) |
type | Set the object type | ManagedImage SharedImage VHD (required) |
ImageTemplateManagedImageDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | "ManagedImage" (required) |
imageId | Resource Id of the Managed Disk Image | string (required) |
location | Azure location for the image, should match if image already exists | string (required) |
ImageTemplateSharedImageDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | "SharedImage" (required) |
galleryImageId | Resource Id of the Shared Image Gallery image | string (required) |
replicationRegions | string[] (required) |
ImageTemplateVhdDistributor
Name | Description | Value |
---|---|---|
type | Type of distribution. | "VHD" (required) |
ImageTemplateSource
Name | Description | Value |
---|---|---|
type | Set the object type | ISO ManagedImage PlatformImage (required) |
ImageTemplateIsoSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | "ISO" (required) |
sha256Checksum | SHA256 Checksum of the ISO image. | string (required) |
sourceURI | URI to get the ISO image. This URI has to be accessible to the resource provider at the time of the image template creation. | string (required) |
ImageTemplateManagedImageSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | "ManagedImage" (required) |
imageId | ARM resource id of the managed image in customer subscription | string (required) |
ImageTemplatePlatformImageSource
Name | Description | Value |
---|---|---|
type | Specifies the type of source image you want to start with. | "PlatformImage" (required) |
offer | Image offer from the Azure Gallery Images. | string |
publisher | Image Publisher in Azure Gallery Images. | string |
sku | Image sku from the Azure Gallery Images. | string |
version | Image version from the Azure Gallery Images. | string |
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for