Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Bicep resource definition
The imageTemplates resource type can be deployed with operations that target:
- 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-05-01-preview' = {
identity: {
type: 'string'
userAssignedIdentities: {
{customized property}: {}
}
}
location: 'string'
name: 'string'
properties: {
buildTimeoutInMinutes: int
customize: [
{
name: 'string'
type: 'string'
// For remaining properties, see ImageTemplateCustomizer objects
}
]
distribute: [
{
artifactTags: {
{customized property}: 'string'
}
runOutputName: 'string'
type: 'string'
// For remaining properties, see ImageTemplateDistributor objects
}
]
source: {
type: 'string'
// For remaining properties, see ImageTemplateSource objects
}
vmProfile: {
vmSize: 'string'
}
}
tags: {
{customized property}: 'string'
}
}
ImageTemplateSource objects
Set the type property to specify the type of object.
For ISO, use:
{
sha256Checksum: 'string'
sourceUri: 'string'
type: 'ISO'
}
For ManagedImage, use:
{
imageId: 'string'
type: 'ManagedImage'
}
For PlatformImage, use:
{
offer: 'string'
publisher: 'string'
sku: 'string'
type: 'PlatformImage'
version: 'string'
}
For SharedImageVersion, use:
{
imageVersionId: 'string'
type: 'SharedImageVersion'
}
ImageTemplateCustomizer objects
Set the type property to specify the type of object.
For File, use:
{
destination: 'string'
sha256Checksum: 'string'
sourceUri: 'string'
type: 'File'
}
For PowerShell, use:
{
inline: [
'string'
]
runElevated: bool
scriptUri: 'string'
sha256Checksum: 'string'
type: 'PowerShell'
validExitCodes: [
int
]
}
For Shell, use:
{
inline: [
'string'
]
scriptUri: 'string'
sha256Checksum: 'string'
type: 'Shell'
}
For WindowsRestart, use:
{
restartCheckCommand: 'string'
restartCommand: 'string'
restartTimeout: 'string'
type: 'WindowsRestart'
}
ImageTemplateDistributor objects
Set the type property to specify the type of object.
For ManagedImage, use:
{
imageId: 'string'
location: 'string'
type: 'ManagedImage'
}
For SharedImage, use:
{
galleryImageId: 'string'
replicationRegions: [
'string'
]
type: 'SharedImage'
}
For VHD, use:
{
type: 'VHD'
}
Property Values
Microsoft.VirtualMachineImages/imageTemplates
| Name | Description | Value |
|---|---|---|
| identity | The identity of the image template, if configured. | ImageTemplateIdentity |
| location | Resource location | string (required) |
| name | The resource name | string Constraints: Pattern = ^[A-Za-z0-9-_.]{1,64}$ (required) |
| properties | The properties of the image template | ImageTemplateProperties |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
| Name | Description | Value |
|---|
ImageTemplateCustomizer
| Name | Description | Value |
|---|---|---|
| name | Friendly Name to provide context on what this customization step does | string |
| type | Set to 'File' for type ImageTemplateFileCustomizer. Set to 'PowerShell' for type ImageTemplatePowerShellCustomizer. Set to 'Shell' for type ImageTemplateShellCustomizer. Set to 'WindowsRestart' for type ImageTemplateRestartCustomizer. | 'File' 'PowerShell' 'Shell' 'WindowsRestart' (required) |
ImageTemplateDistributor
| Name | Description | Value |
|---|---|---|
| artifactTags | Tags that will be applied to the artifact once it has been created/updated by the distributor. | ImageTemplateDistributorArtifactTags |
| runOutputName | The name to be used for the associated RunOutput. | string Constraints: Pattern = ^[A-Za-z0-9-_.]{1,64}$ (required) |
| type | Set to 'ManagedImage' for type ImageTemplateManagedImageDistributor. Set to 'SharedImage' for type ImageTemplateSharedImageDistributor. Set to 'VHD' for type ImageTemplateVhdDistributor. | 'ManagedImage' 'SharedImage' 'VHD' (required) |
ImageTemplateDistributorArtifactTags
| Name | Description | Value |
|---|
ImageTemplateFileCustomizer
| Name | Description | Value |
|---|---|---|
| destination | The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM | string |
| sha256Checksum | SHA256 checksum of the file provided in the sourceUri field above | string |
| sourceUri | The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'File' (required) |
ImageTemplateIdentity
| Name | Description | Value |
|---|---|---|
| type | The type of identity used for the image template. The type 'None' will remove any identities from the image template. | 'None' 'UserAssigned' |
| userAssignedIdentities | The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. | ImageTemplateIdentityUserAssignedIdentities |
ImageTemplateIdentityUserAssignedIdentities
| Name | Description | Value |
|---|
ImageTemplateIsoSource
| Name | Description | Value |
|---|---|---|
| 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) |
| type | Specifies the type of source image you want to start with. | 'ISO' (required) |
ImageTemplateManagedImageDistributor
| Name | Description | Value |
|---|---|---|
| imageId | Resource Id of the Managed Disk Image | string (required) |
| location | Azure location for the image, should match if image already exists | string (required) |
| type | Type of distribution. | 'ManagedImage' (required) |
ImageTemplateManagedImageSource
| Name | Description | Value |
|---|---|---|
| imageId | ARM resource id of the managed image in customer subscription | string (required) |
| type | Specifies the type of source image you want to start with. | 'ManagedImage' (required) |
ImageTemplatePlatformImageSource
| Name | Description | Value |
|---|---|---|
| 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 |
| type | Specifies the type of source image you want to start with. | 'PlatformImage' (required) |
| version | Image version from the Azure Gallery Images. | string |
ImageTemplatePowerShellCustomizer
| Name | Description | Value |
|---|---|---|
| inline | Array of PowerShell commands to execute | string[] |
| runElevated | If specified, the PowerShell script will be run with elevated privileges | bool |
| scriptUri | URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
| sha256Checksum | SHA256 checksum of the power shell script provided in the scriptUri field above | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'PowerShell' (required) |
| validExitCodes | Valid exit codes for the PowerShell script. [Default: 0] | int[] |
ImageTemplateProperties
| Name | Description | Value |
|---|---|---|
| buildTimeoutInMinutes | Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). | int Constraints: Min value = 0 Max value = 960 |
| 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) |
| vmProfile | Describes how virtual machine is set up to build images | ImageTemplateVmProfile |
ImageTemplateRestartCustomizer
| Name | Description | Value |
|---|---|---|
| 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 |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'WindowsRestart' (required) |
ImageTemplateSharedImageDistributor
| Name | Description | Value |
|---|---|---|
| galleryImageId | Resource Id of the Shared Image Gallery image | string (required) |
| replicationRegions | A list of regions that the image will be replicated to | string[] (required) |
| type | Type of distribution. | 'SharedImage' (required) |
ImageTemplateSharedImageVersionSource
| Name | Description | Value |
|---|---|---|
| imageVersionId | ARM resource id of the image version in the shared image gallery | string (required) |
| type | Specifies the type of source image you want to start with. | 'SharedImageVersion' (required) |
ImageTemplateShellCustomizer
| Name | Description | Value |
|---|---|---|
| inline | Array of shell commands to execute | string[] |
| scriptUri | URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
| sha256Checksum | SHA256 checksum of the shell script provided in the scriptUri field | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'Shell' (required) |
ImageTemplateSource
| Name | Description | Value |
|---|---|---|
| type | Set to 'ISO' for type ImageTemplateIsoSource. Set to 'ManagedImage' for type ImageTemplateManagedImageSource. Set to 'PlatformImage' for type ImageTemplatePlatformImageSource. Set to 'SharedImageVersion' for type ImageTemplateSharedImageVersionSource. | 'ISO' 'ManagedImage' 'PlatformImage' 'SharedImageVersion' (required) |
ImageTemplateVhdDistributor
| Name | Description | Value |
|---|---|---|
| type | Type of distribution. | 'VHD' (required) |
ImageTemplateVmProfile
| Name | Description | Value |
|---|---|---|
| vmSize | Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2). | string |
ResourceTags
| Name | Description | Value |
|---|
Usage Examples
Azure Verified Modules
The following Azure Verified Modules can be used to deploy this resource type.
| Module | Description |
|---|---|
| Virtual Machine Image Template | AVM Resource Module for Virtual Machine Image Template |
Azure Quickstart Samples
The following Azure Quickstart templates contain Bicep samples for deploying this resource type.
| Bicep File | 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 (/azure/dev-box/quickstart-create-dev-box). 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 with operations that target:
- 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-05-01-preview",
"name": "string",
"identity": {
"type": "string",
"userAssignedIdentities": {
"{customized property}": {
}
}
},
"location": "string",
"properties": {
"buildTimeoutInMinutes": "int",
"customize": [ {
"name": "string",
"type": "string"
// For remaining properties, see ImageTemplateCustomizer objects
} ],
"distribute": [ {
"artifactTags": {
"{customized property}": "string"
},
"runOutputName": "string",
"type": "string"
// For remaining properties, see ImageTemplateDistributor objects
} ],
"source": {
"type": "string"
// For remaining properties, see ImageTemplateSource objects
},
"vmProfile": {
"vmSize": "string"
}
},
"tags": {
"{customized property}": "string"
}
}
ImageTemplateSource objects
Set the type property to specify the type of object.
For ISO, use:
{
"sha256Checksum": "string",
"sourceUri": "string",
"type": "ISO"
}
For ManagedImage, use:
{
"imageId": "string",
"type": "ManagedImage"
}
For PlatformImage, use:
{
"offer": "string",
"publisher": "string",
"sku": "string",
"type": "PlatformImage",
"version": "string"
}
For SharedImageVersion, use:
{
"imageVersionId": "string",
"type": "SharedImageVersion"
}
ImageTemplateCustomizer objects
Set the type property to specify the type of object.
For File, use:
{
"destination": "string",
"sha256Checksum": "string",
"sourceUri": "string",
"type": "File"
}
For PowerShell, use:
{
"inline": [ "string" ],
"runElevated": "bool",
"scriptUri": "string",
"sha256Checksum": "string",
"type": "PowerShell",
"validExitCodes": [ "int" ]
}
For Shell, use:
{
"inline": [ "string" ],
"scriptUri": "string",
"sha256Checksum": "string",
"type": "Shell"
}
For WindowsRestart, use:
{
"restartCheckCommand": "string",
"restartCommand": "string",
"restartTimeout": "string",
"type": "WindowsRestart"
}
ImageTemplateDistributor objects
Set the type property to specify the type of object.
For ManagedImage, use:
{
"imageId": "string",
"location": "string",
"type": "ManagedImage"
}
For SharedImage, use:
{
"galleryImageId": "string",
"replicationRegions": [ "string" ],
"type": "SharedImage"
}
For VHD, use:
{
"type": "VHD"
}
Property Values
Microsoft.VirtualMachineImages/imageTemplates
| Name | Description | Value |
|---|---|---|
| apiVersion | The api version | '2019-05-01-preview' |
| identity | The identity of the image template, if configured. | ImageTemplateIdentity |
| location | Resource location | string (required) |
| name | The resource name | string Constraints: Pattern = ^[A-Za-z0-9-_.]{1,64}$ (required) |
| properties | The properties of the image template | ImageTemplateProperties |
| tags | Resource tags | Dictionary of tag names and values. See Tags in templates |
| type | The resource type | 'Microsoft.VirtualMachineImages/imageTemplates' |
ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
| Name | Description | Value |
|---|
ImageTemplateCustomizer
| Name | Description | Value |
|---|---|---|
| name | Friendly Name to provide context on what this customization step does | string |
| type | Set to 'File' for type ImageTemplateFileCustomizer. Set to 'PowerShell' for type ImageTemplatePowerShellCustomizer. Set to 'Shell' for type ImageTemplateShellCustomizer. Set to 'WindowsRestart' for type ImageTemplateRestartCustomizer. | 'File' 'PowerShell' 'Shell' 'WindowsRestart' (required) |
ImageTemplateDistributor
| Name | Description | Value |
|---|---|---|
| artifactTags | Tags that will be applied to the artifact once it has been created/updated by the distributor. | ImageTemplateDistributorArtifactTags |
| runOutputName | The name to be used for the associated RunOutput. | string Constraints: Pattern = ^[A-Za-z0-9-_.]{1,64}$ (required) |
| type | Set to 'ManagedImage' for type ImageTemplateManagedImageDistributor. Set to 'SharedImage' for type ImageTemplateSharedImageDistributor. Set to 'VHD' for type ImageTemplateVhdDistributor. | 'ManagedImage' 'SharedImage' 'VHD' (required) |
ImageTemplateDistributorArtifactTags
| Name | Description | Value |
|---|
ImageTemplateFileCustomizer
| Name | Description | Value |
|---|---|---|
| destination | The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM | string |
| sha256Checksum | SHA256 checksum of the file provided in the sourceUri field above | string |
| sourceUri | The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'File' (required) |
ImageTemplateIdentity
| Name | Description | Value |
|---|---|---|
| type | The type of identity used for the image template. The type 'None' will remove any identities from the image template. | 'None' 'UserAssigned' |
| userAssignedIdentities | The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. | ImageTemplateIdentityUserAssignedIdentities |
ImageTemplateIdentityUserAssignedIdentities
| Name | Description | Value |
|---|
ImageTemplateIsoSource
| Name | Description | Value |
|---|---|---|
| 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) |
| type | Specifies the type of source image you want to start with. | 'ISO' (required) |
ImageTemplateManagedImageDistributor
| Name | Description | Value |
|---|---|---|
| imageId | Resource Id of the Managed Disk Image | string (required) |
| location | Azure location for the image, should match if image already exists | string (required) |
| type | Type of distribution. | 'ManagedImage' (required) |
ImageTemplateManagedImageSource
| Name | Description | Value |
|---|---|---|
| imageId | ARM resource id of the managed image in customer subscription | string (required) |
| type | Specifies the type of source image you want to start with. | 'ManagedImage' (required) |
ImageTemplatePlatformImageSource
| Name | Description | Value |
|---|---|---|
| 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 |
| type | Specifies the type of source image you want to start with. | 'PlatformImage' (required) |
| version | Image version from the Azure Gallery Images. | string |
ImageTemplatePowerShellCustomizer
| Name | Description | Value |
|---|---|---|
| inline | Array of PowerShell commands to execute | string[] |
| runElevated | If specified, the PowerShell script will be run with elevated privileges | bool |
| scriptUri | URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
| sha256Checksum | SHA256 checksum of the power shell script provided in the scriptUri field above | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'PowerShell' (required) |
| validExitCodes | Valid exit codes for the PowerShell script. [Default: 0] | int[] |
ImageTemplateProperties
| Name | Description | Value |
|---|---|---|
| buildTimeoutInMinutes | Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). | int Constraints: Min value = 0 Max value = 960 |
| 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) |
| vmProfile | Describes how virtual machine is set up to build images | ImageTemplateVmProfile |
ImageTemplateRestartCustomizer
| Name | Description | Value |
|---|---|---|
| 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 |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'WindowsRestart' (required) |
ImageTemplateSharedImageDistributor
| Name | Description | Value |
|---|---|---|
| galleryImageId | Resource Id of the Shared Image Gallery image | string (required) |
| replicationRegions | A list of regions that the image will be replicated to | string[] (required) |
| type | Type of distribution. | 'SharedImage' (required) |
ImageTemplateSharedImageVersionSource
| Name | Description | Value |
|---|---|---|
| imageVersionId | ARM resource id of the image version in the shared image gallery | string (required) |
| type | Specifies the type of source image you want to start with. | 'SharedImageVersion' (required) |
ImageTemplateShellCustomizer
| Name | Description | Value |
|---|---|---|
| inline | Array of shell commands to execute | string[] |
| scriptUri | URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
| sha256Checksum | SHA256 checksum of the shell script provided in the scriptUri field | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'Shell' (required) |
ImageTemplateSource
| Name | Description | Value |
|---|---|---|
| type | Set to 'ISO' for type ImageTemplateIsoSource. Set to 'ManagedImage' for type ImageTemplateManagedImageSource. Set to 'PlatformImage' for type ImageTemplatePlatformImageSource. Set to 'SharedImageVersion' for type ImageTemplateSharedImageVersionSource. | 'ISO' 'ManagedImage' 'PlatformImage' 'SharedImageVersion' (required) |
ImageTemplateVhdDistributor
| Name | Description | Value |
|---|---|---|
| type | Type of distribution. | 'VHD' (required) |
ImageTemplateVmProfile
| Name | Description | Value |
|---|---|---|
| vmSize | Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2). | string |
ResourceTags
| Name | Description | Value |
|---|
Usage Examples
Azure Quickstart Templates
The following Azure 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 (/azure/dev-box/quickstart-create-dev-box). 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 with operations that target:
- 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-05-01-preview"
name = "string"
parent_id = "string"
identity {
type = "string"
identity_ids = [
"string"
]
}
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
buildTimeoutInMinutes = int
customize = [
{
name = "string"
type = "string"
// For remaining properties, see ImageTemplateCustomizer objects
}
]
distribute = [
{
artifactTags = {
{customized property} = "string"
}
runOutputName = "string"
type = "string"
// For remaining properties, see ImageTemplateDistributor objects
}
]
source = {
type = "string"
// For remaining properties, see ImageTemplateSource objects
}
vmProfile = {
vmSize = "string"
}
}
}
}
ImageTemplateSource objects
Set the type property to specify the type of object.
For ISO, use:
{
sha256Checksum = "string"
sourceUri = "string"
type = "ISO"
}
For ManagedImage, use:
{
imageId = "string"
type = "ManagedImage"
}
For PlatformImage, use:
{
offer = "string"
publisher = "string"
sku = "string"
type = "PlatformImage"
version = "string"
}
For SharedImageVersion, use:
{
imageVersionId = "string"
type = "SharedImageVersion"
}
ImageTemplateCustomizer objects
Set the type property to specify the type of object.
For File, use:
{
destination = "string"
sha256Checksum = "string"
sourceUri = "string"
type = "File"
}
For PowerShell, use:
{
inline = [
"string"
]
runElevated = bool
scriptUri = "string"
sha256Checksum = "string"
type = "PowerShell"
validExitCodes = [
int
]
}
For Shell, use:
{
inline = [
"string"
]
scriptUri = "string"
sha256Checksum = "string"
type = "Shell"
}
For WindowsRestart, use:
{
restartCheckCommand = "string"
restartCommand = "string"
restartTimeout = "string"
type = "WindowsRestart"
}
ImageTemplateDistributor objects
Set the type property to specify the type of object.
For ManagedImage, use:
{
imageId = "string"
location = "string"
type = "ManagedImage"
}
For SharedImage, use:
{
galleryImageId = "string"
replicationRegions = [
"string"
]
type = "SharedImage"
}
For VHD, use:
{
type = "VHD"
}
Property Values
Microsoft.VirtualMachineImages/imageTemplates
| Name | Description | Value |
|---|---|---|
| identity | The identity of the image template, if configured. | ImageTemplateIdentity |
| location | Resource location | string (required) |
| name | The resource name | string Constraints: Pattern = ^[A-Za-z0-9-_.]{1,64}$ (required) |
| properties | The properties of the image template | ImageTemplateProperties |
| tags | Resource tags | Dictionary of tag names and values. |
| type | The resource type | "Microsoft.VirtualMachineImages/imageTemplates@2019-05-01-preview" |
ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties
| Name | Description | Value |
|---|
ImageTemplateCustomizer
| Name | Description | Value |
|---|---|---|
| name | Friendly Name to provide context on what this customization step does | string |
| type | Set to 'File' for type ImageTemplateFileCustomizer. Set to 'PowerShell' for type ImageTemplatePowerShellCustomizer. Set to 'Shell' for type ImageTemplateShellCustomizer. Set to 'WindowsRestart' for type ImageTemplateRestartCustomizer. | 'File' 'PowerShell' 'Shell' 'WindowsRestart' (required) |
ImageTemplateDistributor
| Name | Description | Value |
|---|---|---|
| artifactTags | Tags that will be applied to the artifact once it has been created/updated by the distributor. | ImageTemplateDistributorArtifactTags |
| runOutputName | The name to be used for the associated RunOutput. | string Constraints: Pattern = ^[A-Za-z0-9-_.]{1,64}$ (required) |
| type | Set to 'ManagedImage' for type ImageTemplateManagedImageDistributor. Set to 'SharedImage' for type ImageTemplateSharedImageDistributor. Set to 'VHD' for type ImageTemplateVhdDistributor. | 'ManagedImage' 'SharedImage' 'VHD' (required) |
ImageTemplateDistributorArtifactTags
| Name | Description | Value |
|---|
ImageTemplateFileCustomizer
| Name | Description | Value |
|---|---|---|
| destination | The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM | string |
| sha256Checksum | SHA256 checksum of the file provided in the sourceUri field above | string |
| sourceUri | The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'File' (required) |
ImageTemplateIdentity
| Name | Description | Value |
|---|---|---|
| type | The type of identity used for the image template. The type 'None' will remove any identities from the image template. | 'None' 'UserAssigned' |
| userAssignedIdentities | The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. | ImageTemplateIdentityUserAssignedIdentities |
ImageTemplateIdentityUserAssignedIdentities
| Name | Description | Value |
|---|
ImageTemplateIsoSource
| Name | Description | Value |
|---|---|---|
| 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) |
| type | Specifies the type of source image you want to start with. | 'ISO' (required) |
ImageTemplateManagedImageDistributor
| Name | Description | Value |
|---|---|---|
| imageId | Resource Id of the Managed Disk Image | string (required) |
| location | Azure location for the image, should match if image already exists | string (required) |
| type | Type of distribution. | 'ManagedImage' (required) |
ImageTemplateManagedImageSource
| Name | Description | Value |
|---|---|---|
| imageId | ARM resource id of the managed image in customer subscription | string (required) |
| type | Specifies the type of source image you want to start with. | 'ManagedImage' (required) |
ImageTemplatePlatformImageSource
| Name | Description | Value |
|---|---|---|
| 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 |
| type | Specifies the type of source image you want to start with. | 'PlatformImage' (required) |
| version | Image version from the Azure Gallery Images. | string |
ImageTemplatePowerShellCustomizer
| Name | Description | Value |
|---|---|---|
| inline | Array of PowerShell commands to execute | string[] |
| runElevated | If specified, the PowerShell script will be run with elevated privileges | bool |
| scriptUri | URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
| sha256Checksum | SHA256 checksum of the power shell script provided in the scriptUri field above | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'PowerShell' (required) |
| validExitCodes | Valid exit codes for the PowerShell script. [Default: 0] | int[] |
ImageTemplateProperties
| Name | Description | Value |
|---|---|---|
| buildTimeoutInMinutes | Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). | int Constraints: Min value = 0 Max value = 960 |
| 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) |
| vmProfile | Describes how virtual machine is set up to build images | ImageTemplateVmProfile |
ImageTemplateRestartCustomizer
| Name | Description | Value |
|---|---|---|
| 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 |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'WindowsRestart' (required) |
ImageTemplateSharedImageDistributor
| Name | Description | Value |
|---|---|---|
| galleryImageId | Resource Id of the Shared Image Gallery image | string (required) |
| replicationRegions | A list of regions that the image will be replicated to | string[] (required) |
| type | Type of distribution. | 'SharedImage' (required) |
ImageTemplateSharedImageVersionSource
| Name | Description | Value |
|---|---|---|
| imageVersionId | ARM resource id of the image version in the shared image gallery | string (required) |
| type | Specifies the type of source image you want to start with. | 'SharedImageVersion' (required) |
ImageTemplateShellCustomizer
| Name | Description | Value |
|---|---|---|
| inline | Array of shell commands to execute | string[] |
| scriptUri | URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc | string |
| sha256Checksum | SHA256 checksum of the shell script provided in the scriptUri field | string |
| type | The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer | 'Shell' (required) |
ImageTemplateSource
| Name | Description | Value |
|---|---|---|
| type | Set to 'ISO' for type ImageTemplateIsoSource. Set to 'ManagedImage' for type ImageTemplateManagedImageSource. Set to 'PlatformImage' for type ImageTemplatePlatformImageSource. Set to 'SharedImageVersion' for type ImageTemplateSharedImageVersionSource. | 'ISO' 'ManagedImage' 'PlatformImage' 'SharedImageVersion' (required) |
ImageTemplateVhdDistributor
| Name | Description | Value |
|---|---|---|
| type | Type of distribution. | 'VHD' (required) |
ImageTemplateVmProfile
| Name | Description | Value |
|---|---|---|
| vmSize | Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2). | string |
ResourceTags
| Name | Description | Value |
|---|