Virtual Machine Image Templates - Create Or Update
Create or update a virtual machine image template
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}?api-version=2022-07-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
image
|
path | True |
string pattern: ^[A-Za-z0-9-_.]{1,64}$ |
The name of the image Template |
resource
|
path | True |
string |
The name of the resource group. |
subscription
|
path | True |
string |
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. |
api-version
|
query | True |
string |
Client Api Version. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
identity | True |
The identity of the image template, if configured. |
|
location | True |
string |
The geo-location where the resource lives |
properties.distribute | True | ImageTemplateDistributor[]: |
The distribution targets where the image output needs to go to. |
properties.source | True | ImageTemplateSource: |
Specifies the properties used to describe the source image. |
properties.buildTimeoutInMinutes |
integer (int32) minimum: 0maximum: 960 |
Maximum duration to wait while building the image template (includes all customizations, optimization, validations, and distributions). Omit or specify 0 to use the default (4 hours). |
|
properties.customize | ImageTemplateCustomizer[]: |
Specifies the properties used to describe the customization steps of the image, like Image source etc |
|
properties.optimize |
Specifies optimization to be performed on image. |
||
properties.stagingResourceGroup |
string |
The staging resource group id in the same subscription as the image template that will be used to build the image. If this field is empty, a resource group with a random name will be created. If the resource group specified in this field doesn't exist, it will be created with the same name. If the resource group specified exists, it must be empty and in the same region as the image template. The resource group created will be deleted during template deletion if this field is empty or the resource group specified doesn't exist, but if the resource group specified exists the resources created in the resource group will be deleted during template deletion and the resource group itself will remain. |
|
properties.validate |
Configuration options and list of validations to be performed on the resulting image. |
||
properties.vmProfile |
Describes how virtual machine is set up to build images |
||
tags |
object |
Resource tags. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
201 Created |
Created |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Create an Image Template for Linux. |
Create an Image Template for Windows. |
Create an Image Template for Linux.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.VirtualMachineImages/imageTemplates/myImageTemplate?api-version=2022-07-01
{
"location": "westus",
"tags": {
"imagetemplate_tag1": "IT_T1",
"imagetemplate_tag2": "IT_T2"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {}
}
},
"properties": {
"source": {
"type": "ManagedImage",
"imageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"
},
"customize": [
{
"type": "Shell",
"name": "Shell Customizer Example",
"scriptUri": "https://example.com/path/to/script.sh"
}
],
"distribute": [
{
"type": "ManagedImage",
"location": "1_location",
"runOutputName": "image_it_pir_1",
"imageId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1",
"artifactTags": {
"tagName": "value"
}
}
],
"vmProfile": {
"vmSize": "Standard_D2s_v3",
"osDiskSizeGB": 64,
"vnetConfig": {
"subnetId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"
}
}
}
}
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.VirtualMachineImages/imageTemplates/myImageTemplate",
"name": "myImageTemplate",
"location": "westus",
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {
"clientId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
}
}
},
"properties": {
"source": {
"type": "ManagedImage",
"imageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"
},
"customize": [
{
"type": "Shell",
"name": "Shell Customizer Example",
"scriptUri": "https://example.com/path/to/script.sh"
}
],
"distribute": [
{
"type": "ManagedImage",
"location": "1_location",
"runOutputName": "image_it_pir_1",
"imageId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1",
"artifactTags": {
"tagName": "value"
}
}
],
"vmProfile": {
"vmSize": "Standard_D2s_v3",
"osDiskSizeGB": 64,
"vnetConfig": {
"subnetId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"
}
}
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.VirtualMachineImages/imageTemplates/myImageTemplate",
"name": "myImageTemplate",
"location": "westus",
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {
"clientId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
}
}
},
"properties": {
"source": {
"type": "ManagedImage",
"imageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"
},
"customize": [
{
"type": "Shell",
"name": "Shell Customizer Example",
"scriptUri": "https://example.com/path/to/script.sh"
}
],
"distribute": [
{
"type": "ManagedImage",
"location": "1_location",
"runOutputName": "image_it_pir_1",
"imageId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1",
"artifactTags": {
"tagName": "value"
}
}
],
"vmProfile": {
"vmSize": "Standard_D2s_v3",
"osDiskSizeGB": 64
}
}
}
Create an Image Template for Windows.
Sample request
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.VirtualMachineImages/imageTemplates/myImageTemplate?api-version=2022-07-01
{
"location": "westus",
"tags": {
"imagetemplate_tag1": "IT_T1",
"imagetemplate_tag2": "IT_T2"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {}
}
},
"properties": {
"source": {
"type": "ManagedImage",
"imageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"
},
"customize": [
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
]
},
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Elevated user Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": true
},
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Elevated Local System user Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": true,
"runAsSystem": true
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"validExitCodes": [
0,
1
]
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Elevated Local System user Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"runElevated": true,
"validExitCodes": [
0,
1
]
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Elevated Local System user Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"runElevated": true,
"runAsSystem": true,
"validExitCodes": [
0,
1
]
},
{
"type": "WindowsRestart",
"name": "Restart Customizer Example",
"restartCommand": "shutdown /f /r /t 0 /c \"packer restart\"",
"restartCheckCommand": "powershell -command \"& {Write-Output 'restarted.'}\"",
"restartTimeout": "10m"
},
{
"type": "WindowsUpdate",
"name": "Windows Update Customizer Example",
"searchCriteria": "BrowseOnly=0 and IsInstalled=0",
"filters": [
"$_.BrowseOnly"
],
"updateLimit": 100
}
],
"distribute": [
{
"type": "ManagedImage",
"location": "1_location",
"runOutputName": "image_it_pir_1",
"imageId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1",
"artifactTags": {
"tagName": "value"
}
}
],
"vmProfile": {
"vmSize": "Standard_D2s_v3",
"osDiskSizeGB": 64,
"vnetConfig": {
"subnetId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"
}
}
}
}
Sample response
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.VirtualMachineImages/imageTemplates/myImageTemplate",
"name": "myImageTemplate",
"location": "westus",
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {
"clientId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
}
}
},
"properties": {
"source": {
"type": "ManagedImage",
"imageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"
},
"customize": [
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": false,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Elevated user Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": true,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Elevated Local System user Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": true,
"runAsSystem": true
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"validExitCodes": [
0,
1
],
"runElevated": false,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Elevated Local System user Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"runElevated": true,
"runAsSystem": false,
"validExitCodes": [
0,
1
]
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Elevated Local System user Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"runElevated": true,
"runAsSystem": true,
"validExitCodes": [
0,
1
]
},
{
"type": "WindowsRestart",
"name": "Restart Customizer Example",
"restartCommand": "shutdown /f /r /t 0 /c \"packer restart\"",
"restartCheckCommand": "powershell -command \"& {Write-Output 'restarted.'}\"",
"restartTimeout": "10m"
},
{
"type": "WindowsUpdate",
"name": "Windows Update Customizer Example",
"searchCriteria": "BrowseOnly=0 and IsInstalled=0",
"filters": [
"$_.BrowseOnly"
],
"updateLimit": 100
}
],
"distribute": [
{
"type": "ManagedImage",
"location": "1_location",
"runOutputName": "image_it_pir_1",
"imageId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1",
"artifactTags": {
"tagName": "value"
}
}
],
"vmProfile": {
"vmSize": "Standard_D2s_v3",
"osDiskSizeGB": 64,
"vnetConfig": {
"subnetId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"
}
}
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.VirtualMachineImages/imageTemplates/myImageTemplate",
"name": "myImageTemplate",
"location": "westus",
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1": {
"clientId": "00000000-0000-0000-0000-000000000000",
"principalId": "00000000-0000-0000-0000-000000000000"
}
}
},
"properties": {
"source": {
"type": "ManagedImage",
"imageId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image"
},
"customize": [
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": false,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Elevated user Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": true,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "PowerShell (inline) Customizer Elevated Local System user Example",
"inline": [
"Powershell command-1",
"Powershell command-2",
"Powershell command-3"
],
"runElevated": true,
"runAsSystem": true
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"validExitCodes": [
0,
1
],
"runElevated": false,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Elevated Local System user Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"runElevated": true,
"runAsSystem": false,
"validExitCodes": [
0,
1
]
},
{
"type": "PowerShell",
"name": "PowerShell (script) Customizer Elevated Local System user Example",
"scriptUri": "https://example.com/path/to/script.ps1",
"runElevated": true,
"runAsSystem": true,
"validExitCodes": [
0,
1
]
},
{
"type": "WindowsRestart",
"name": "Restart Customizer Example",
"restartCommand": "shutdown /f /r /t 0 /c \"packer restart\"",
"restartCheckCommand": "powershell -command \"& {Write-Output 'restarted.'}\"",
"restartTimeout": "10m"
},
{
"type": "WindowsUpdate",
"name": "Windows Update Customizer Example",
"searchCriteria": "BrowseOnly=0 and IsInstalled=0",
"filters": [
"$_.BrowseOnly"
],
"updateLimit": 100
}
],
"distribute": [
{
"type": "ManagedImage",
"location": "1_location",
"runOutputName": "image_it_pir_1",
"imageId": "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1",
"artifactTags": {
"tagName": "value"
}
}
],
"vmProfile": {
"vmSize": "Standard_D2s_v3",
"osDiskSizeGB": 64
}
}
}
Definitions
Name | Description |
---|---|
Cloud |
An error response from the Azure VM Image Builder service. |
Cloud |
An error response from the Azure VM Image Builder service. |
created |
The type of identity that created the resource. |
Distribute |
Generates version number that will be latest based on existing version numbers. |
Distribute |
Generates version number based on version number of source image |
Image |
Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider |
Image |
Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner |
Image |
Uploads files required for validation to VMs (Linux, Windows). Corresponds to Packer file provisioner |
Image |
Identity for the image template. |
Image |
Describes the latest status of running an image template |
Image |
Distribute as a Managed Disk Image. |
Image |
Describes an image source that is a managed image in customer subscription. This image must reside in the same subscription and region as the Image Builder template. |
Image |
Describes an image source from Azure Gallery Images. |
Image |
Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. |
Image |
Runs the specified PowerShell script during the validation phase (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. |
Image |
Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner |
Image |
Distribute via Azure Compute Gallery. |
Image |
Describes an image source that is an image version in an Azure Compute Gallery or a Direct Shared Gallery. |
Image |
Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. |
Image |
Runs the specified shell script during the validation phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. |
Image |
Distribute via VHD in a storage account. |
Image |
Describes the virtual machines used to build and validate images |
Image |
Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) |
Optimize |
Specifies optimization to be performed on image. |
Platform |
Purchase plan configuration for platform image. |
Provisioning |
Describes the error happened when create or update an image template |
Provisioning |
Error code of the provisioning failure |
Provisioning |
Provisioning state of the resource |
Resource |
The type of identity used for the image template. The type 'None' will remove any identities from the image template. |
Run |
State of the last run |
Run |
Sub-state of the last run |
Shared |
Specifies the storage account type to be used to store the Azure Compute Gallery image version in. |
system |
Metadata pertaining to creation and last modification of the resource. |
Target |
Describes the target region information. |
User |
User assigned identity properties |
Validate |
Configuration options and list of validations to be performed on the resulting image. |
Virtual |
Virtual Network configuration. |
Vm |
Optimization is applied on the image for a faster VM boot. |
VMBoot |
Enabling this field will improve VM boot time by optimizing the final customized image output. |
CloudError
An error response from the Azure VM Image Builder service.
Name | Type | Description |
---|---|---|
error |
Details about the error. |
CloudErrorBody
An error response from the Azure VM Image Builder service.
Name | Type | Description |
---|---|---|
code |
string |
An identifier for the error. Codes are invariant and are intended to be consumed programmatically. |
details |
A list of additional details about the error. |
|
message |
string |
A message describing the error, intended to be suitable for display in a user interface. |
target |
string |
The target of the particular error. For example, the name of the property in error. |
createdByType
The type of identity that created the resource.
Value | Description |
---|---|
Application | |
Key | |
ManagedIdentity | |
User |
DistributeVersionerLatest
Generates version number that will be latest based on existing version numbers.
Name | Type | Default value | Description |
---|---|---|---|
major |
integer (int32) minimum: -1 |
-1 |
Major version for the generated version number. Determine what is "latest" based on versions with this value as the major version. -1 is equivalent to leaving it unset. |
scheme |
string:
Latest |
Version numbering scheme to be used. |
DistributeVersionerSource
Generates version number based on version number of source image
Name | Type | Description |
---|---|---|
scheme |
string:
Source |
Version numbering scheme to be used. |
ImageTemplate
Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider
Name | Type | Default value | Description |
---|---|---|---|
id |
string |
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
|
identity |
The identity of the image template, if configured. |
||
location |
string |
The geo-location where the resource lives |
|
name |
string |
The name of the resource |
|
properties.buildTimeoutInMinutes |
integer (int32) minimum: 0maximum: 960 |
0 |
Maximum duration to wait while building the image template (includes all customizations, optimization, validations, and distributions). Omit or specify 0 to use the default (4 hours). |
properties.customize | ImageTemplateCustomizer[]: |
Specifies the properties used to describe the customization steps of the image, like Image source etc |
|
properties.distribute | ImageTemplateDistributor[]: |
The distribution targets where the image output needs to go to. |
|
properties.exactStagingResourceGroup |
string |
The staging resource group id in the same subscription as the image template that will be used to build the image. This read-only field differs from 'stagingResourceGroup' only if the value specified in the 'stagingResourceGroup' field is empty. |
|
properties.lastRunStatus |
State of 'run' that is currently executing or was last executed. |
||
properties.optimize |
Specifies optimization to be performed on image. |
||
properties.provisioningError |
Provisioning error, if any |
||
properties.provisioningState |
Provisioning state of the resource |
||
properties.source | ImageTemplateSource: |
Specifies the properties used to describe the source image. |
|
properties.stagingResourceGroup |
string |
The staging resource group id in the same subscription as the image template that will be used to build the image. If this field is empty, a resource group with a random name will be created. If the resource group specified in this field doesn't exist, it will be created with the same name. If the resource group specified exists, it must be empty and in the same region as the image template. The resource group created will be deleted during template deletion if this field is empty or the resource group specified doesn't exist, but if the resource group specified exists the resources created in the resource group will be deleted during template deletion and the resource group itself will remain. |
|
properties.validate |
Configuration options and list of validations to be performed on the resulting image. |
||
properties.vmProfile |
Describes how virtual machine is set up to build images |
||
systemData |
Azure Resource Manager metadata containing createdBy and modifiedBy information. |
||
tags |
object |
Resource tags. |
|
type |
string |
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" |
ImageTemplateFileCustomizer
Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner
Name | Type | Description |
---|---|---|
destination |
string |
The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM |
name |
string |
Friendly Name to provide context on what this customization step does |
sha256Checksum |
string |
SHA256 checksum of the file provided in the sourceUri field above |
sourceUri |
string |
The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc |
type |
string:
File |
The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer |
ImageTemplateFileValidator
Uploads files required for validation to VMs (Linux, Windows). Corresponds to Packer file provisioner
Name | Type | Description |
---|---|---|
destination |
string |
The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM |
name |
string |
Friendly Name to provide context on what this validation step does |
sha256Checksum |
string |
SHA256 checksum of the file provided in the sourceUri field above |
sourceUri |
string |
The URI of the file to be uploaded to the VM for validation. It can be a github link, Azure Storage URI (authorized or SAS), etc |
type |
string:
File |
The type of validation you want to use on the Image. For example, "Shell" can be shell validation |
ImageTemplateIdentity
Identity for the image template.
Name | Type | Description |
---|---|---|
type |
The type of identity used for the image template. The type 'None' will remove any identities from the image template. |
|
userAssignedIdentities |
<string,
User |
User-Assigned Identities |
ImageTemplateLastRunStatus
Describes the latest status of running an image template
Name | Type | Description |
---|---|---|
endTime |
string (date-time) |
End time of the last run (UTC) |
message |
string |
Verbose information about the last run state |
runState |
State of the last run |
|
runSubState |
Sub-state of the last run |
|
startTime |
string (date-time) |
Start time of the last run (UTC) |
ImageTemplateManagedImageDistributor
Distribute as a Managed Disk Image.
Name | Type | Description |
---|---|---|
artifactTags |
object |
Tags that will be applied to the artifact once it has been created/updated by the distributor. |
imageId |
string |
Resource Id of the Managed Disk Image |
location |
string |
Azure location for the image, should match if image already exists |
runOutputName |
string pattern: ^[A-Za-z0-9-_.]{1,64}$ |
The name to be used for the associated RunOutput. |
type |
string:
Managed |
Type of distribution. |
ImageTemplateManagedImageSource
Describes an image source that is a managed image in customer subscription. This image must reside in the same subscription and region as the Image Builder template.
Name | Type | Description |
---|---|---|
imageId |
string |
ARM resource id of the managed image in customer subscription |
type |
string:
Managed |
Specifies the type of source image you want to start with. |
ImageTemplatePlatformImageSource
Describes an image source from Azure Gallery Images.
Name | Type | Description |
---|---|---|
exactVersion |
string |
Image version from the Azure Gallery Images. This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'. |
offer |
string |
Image offer from the Azure Gallery Images. |
planInfo |
Optional configuration of purchase plan for platform image. |
|
publisher |
string |
Image Publisher in Azure Gallery Images. |
sku |
string |
Image sku from the Azure Gallery Images. |
type |
string:
Platform |
Specifies the type of source image you want to start with. |
version |
string |
Image version from the Azure Gallery Images. If 'latest' is specified here, the version is evaluated when the image build takes place, not when the template is submitted. |
ImageTemplatePowerShellCustomizer
Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.
Name | Type | Default value | Description |
---|---|---|---|
inline |
string[] |
Array of PowerShell commands to execute |
|
name |
string |
Friendly Name to provide context on what this customization step does |
|
runAsSystem |
boolean |
False |
If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true. |
runElevated |
boolean |
False |
If specified, the PowerShell script will be run with elevated privileges |
scriptUri |
string |
URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc |
|
sha256Checksum |
string |
SHA256 checksum of the power shell script provided in the scriptUri field above |
|
type |
string:
Power |
The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer |
|
validExitCodes |
integer[] (int32) |
Valid exit codes for the PowerShell script. [Default: 0] |
ImageTemplatePowerShellValidator
Runs the specified PowerShell script during the validation phase (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.
Name | Type | Default value | Description |
---|---|---|---|
inline |
string[] |
Array of PowerShell commands to execute |
|
name |
string |
Friendly Name to provide context on what this validation step does |
|
runAsSystem |
boolean |
False |
If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true. |
runElevated |
boolean |
False |
If specified, the PowerShell script will be run with elevated privileges |
scriptUri |
string |
URI of the PowerShell script to be run for validation. It can be a github link, Azure Storage URI, etc |
|
sha256Checksum |
string |
SHA256 checksum of the power shell script provided in the scriptUri field above |
|
type |
string:
Power |
The type of validation you want to use on the Image. For example, "Shell" can be shell validation |
|
validExitCodes |
integer[] (int32) |
Valid exit codes for the PowerShell script. [Default: 0] |
ImageTemplateRestartCustomizer
Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner
Name | Type | Description |
---|---|---|
name |
string |
Friendly Name to provide context on what this customization step does |
restartCheckCommand |
string |
Command to check if restart succeeded [Default: ''] |
restartCommand |
string |
Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] |
restartTimeout |
string |
Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] |
type |
string:
Windows |
The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer |
ImageTemplateSharedImageDistributor
Distribute via Azure Compute Gallery.
Name | Type | Default value | Description |
---|---|---|---|
artifactTags |
object |
Tags that will be applied to the artifact once it has been created/updated by the distributor. |
|
excludeFromLatest |
boolean |
False |
Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). |
galleryImageId |
string |
Resource Id of the Azure Compute Gallery image |
|
replicationRegions |
string[] |
[Deprecated] A list of regions that the image will be replicated to. This list can be specified only if targetRegions is not specified. This field is deprecated - use targetRegions instead. |
|
runOutputName |
string pattern: ^[A-Za-z0-9-_.]{1,64}$ |
The name to be used for the associated RunOutput. |
|
storageAccountType |
[Deprecated] Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). This field can be specified only if replicationRegions is specified. This field is deprecated - use targetRegions instead. |
||
targetRegions |
The target regions where the distributed Image Version is going to be replicated to. This object supersedes replicationRegions and can be specified only if replicationRegions is not specified. |
||
type |
string:
Shared |
Type of distribution. |
|
versioning | DistributeVersioner: |
Describes how to generate new x.y.z version number for distribution. |
ImageTemplateSharedImageVersionSource
Describes an image source that is an image version in an Azure Compute Gallery or a Direct Shared Gallery.
Name | Type | Description |
---|---|---|
exactVersion |
string |
Exact ARM resource id of the image version. This readonly field differs from the image version Id in 'imageVersionId' only if the version name specified in 'imageVersionId' field is 'latest'. |
imageVersionId |
string |
ARM resource id of the image version. When image version name is 'latest', the version is evaluated when the image build takes place. |
type |
string:
Shared |
Specifies the type of source image you want to start with. |
ImageTemplateShellCustomizer
Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.
Name | Type | Description |
---|---|---|
inline |
string[] |
Array of shell commands to execute |
name |
string |
Friendly Name to provide context on what this customization step does |
scriptUri |
string |
URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc |
sha256Checksum |
string |
SHA256 checksum of the shell script provided in the scriptUri field |
type |
string:
Shell |
The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer |
ImageTemplateShellValidator
Runs the specified shell script during the validation phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.
Name | Type | Description |
---|---|---|
inline |
string[] |
Array of shell commands to execute |
name |
string |
Friendly Name to provide context on what this validation step does |
scriptUri |
string |
URI of the shell script to be run for validation. It can be a github link, Azure Storage URI, etc |
sha256Checksum |
string |
SHA256 checksum of the shell script provided in the scriptUri field |
type |
string:
Shell |
The type of validation you want to use on the Image. For example, "Shell" can be shell validation |
ImageTemplateVhdDistributor
Distribute via VHD in a storage account.
Name | Type | Description |
---|---|---|
artifactTags |
object |
Tags that will be applied to the artifact once it has been created/updated by the distributor. |
runOutputName |
string pattern: ^[A-Za-z0-9-_.]{1,64}$ |
The name to be used for the associated RunOutput. |
type |
string:
VHD |
Type of distribution. |
uri |
string |
Optional Azure Storage URI for the distributed VHD blob. Omit to use the default (empty string) in which case VHD would be published to the storage account in the staging resource group. |
ImageTemplateVmProfile
Describes the virtual machines used to build and validate images
Name | Type | Default value | Description |
---|---|---|---|
osDiskSizeGB |
integer (int32) minimum: 0 |
0 |
Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. |
userAssignedIdentities |
string[] |
Optional array of resource IDs of user assigned managed identities to be configured on the build VM and validation VM. This may include the identity of the image template. |
|
vmSize |
string |
Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2 images). |
|
vnetConfig |
Optional configuration of the virtual network to use to deploy the build VM and validation VM in. Omit if no specific virtual network needs to be used. |
ImageTemplateWindowsUpdateCustomizer
Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update)
Name | Type | Default value | Description |
---|---|---|---|
filters |
string[] |
Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field. |
|
name |
string |
Friendly Name to provide context on what this customization step does |
|
searchCriteria |
string |
Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field. |
|
type |
string:
Windows |
The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer |
|
updateLimit |
integer (int32) minimum: 0 |
0 |
Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) |
Optimize
Specifies optimization to be performed on image.
Name | Type | Description |
---|---|---|
vmBoot |
Optimization is applied on the image for a faster VM boot. |
PlatformImagePurchasePlan
Purchase plan configuration for platform image.
Name | Type | Description |
---|---|---|
planName |
string |
Name of the purchase plan. |
planProduct |
string |
Product of the purchase plan. |
planPublisher |
string |
Publisher of the purchase plan. |
ProvisioningError
Describes the error happened when create or update an image template
Name | Type | Description |
---|---|---|
message |
string |
Verbose error message about the provisioning failure |
provisioningErrorCode |
Error code of the provisioning failure |
ProvisioningErrorCode
Error code of the provisioning failure
Value | Description |
---|---|
BadCustomizerType | |
BadDistributeType | |
BadManagedImageSource | |
BadPIRSource | |
BadSharedImageDistribute | |
BadSharedImageVersionSource | |
BadSourceType | |
BadStagingResourceGroup | |
BadValidatorType | |
NoCustomizerScript | |
NoValidatorScript | |
Other | |
ServerError | |
UnsupportedCustomizerType | |
UnsupportedValidatorType |
ProvisioningState
Provisioning state of the resource
Value | Description |
---|---|
Canceled | |
Creating | |
Deleting | |
Failed | |
Succeeded | |
Updating |
ResourceIdentityType
The type of identity used for the image template. The type 'None' will remove any identities from the image template.
Value | Description |
---|---|
None | |
UserAssigned |
RunState
State of the last run
Value | Description |
---|---|
Canceled | |
Canceling | |
Failed | |
PartiallySucceeded | |
Running | |
Succeeded |
RunSubState
Sub-state of the last run
Value | Description |
---|---|
Building | |
Customizing | |
Distributing | |
Optimizing | |
Queued | |
Validating |
SharedImageStorageAccountType
Specifies the storage account type to be used to store the Azure Compute Gallery image version in.
Value | Description |
---|---|
Premium_LRS | |
Standard_LRS | |
Standard_ZRS |
systemData
Metadata pertaining to creation and last modification of the resource.
Name | Type | Description |
---|---|---|
createdAt |
string (date-time) |
The timestamp of resource creation (UTC). |
createdBy |
string |
The identity that created the resource. |
createdByType |
The type of identity that created the resource. |
|
lastModifiedAt |
string (date-time) |
The timestamp of resource last modification (UTC) |
lastModifiedBy |
string |
The identity that last modified the resource. |
lastModifiedByType |
The type of identity that last modified the resource. |
TargetRegion
Describes the target region information.
Name | Type | Default value | Description |
---|---|---|---|
name |
string |
The name of the region. |
|
replicaCount |
integer (int32) minimum: 1 |
1 |
The number of replicas of the Image Version to be created in this region. Omit to use the default (1). |
storageAccountType |
Specifies the storage account type to be used to store the image in this region. Omit to use the default (Standard_LRS). |
UserAssignedIdentity
User assigned identity properties
Name | Type | Description |
---|---|---|
clientId |
string |
The client ID of the assigned identity. |
principalId |
string |
The principal ID of the assigned identity. |
Validate
Configuration options and list of validations to be performed on the resulting image.
Name | Type | Default value | Description |
---|---|---|---|
continueDistributeOnFailure |
boolean |
False |
If validation fails and this field is set to false, output image(s) will not be distributed. This is the default behavior. If validation fails and this field is set to true, output image(s) will still be distributed. Please use this option with caution as it may result in bad images being distributed for use. In either case (true or false), the end to end image run will be reported as having failed in case of a validation failure. [Note: This field has no effect if validation succeeds.] |
inVMValidations | ImageTemplateInVMValidator[]: |
List of validations to be performed. |
|
sourceValidationOnly |
boolean |
False |
If this field is set to true, the image specified in the 'source' section will directly be validated. No separate build will be run to generate and then validate a customized image. |
VirtualNetworkConfig
Virtual Network configuration.
Name | Type | Description |
---|---|---|
proxyVmSize |
string |
Size of the proxy virtual machine used to pass traffic to the build VM and validation VM. Omit or specify empty string to use the default (Standard_A1_v2). |
subnetId |
string |
Resource id of a pre-existing subnet. |
VmBoot
Optimization is applied on the image for a faster VM boot.
Name | Type | Description |
---|---|---|
state |
Enabling this field will improve VM boot time by optimizing the final customized image output. |
VMBootOptimizationState
Enabling this field will improve VM boot time by optimizing the final customized image output.
Value | Description |
---|---|
Disabled | |
Enabled |