virtual_machine_image_templates
Creates, updates, deletes, gets or lists a virtual_machine_image_templates resource.
Overview
| Name | virtual_machine_image_templates |
| Type | Resource |
| Id | azure.image_builder.virtual_machine_image_templates |
Fields
The following fields are returned by SELECT queries:
- get_run_output
- get
- list_by_resource_group
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
artifactId | string | The resource id of the artifact. |
artifactUri | string | The location URI of the artifact. |
provisioningState | string | Provisioning state of the resource. Known values are: "Creating", "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". (Creating, Updating, Succeeded, Failed, Deleting, Canceled) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
additionalDataDisks | array | Optional array of additional data disks to be added to the image. |
autoRun | object | Indicates whether or not to automatically run the image template build on template creation or update. |
buildTimeoutInMinutes | integer | 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). |
customize | array | Specifies the properties used to describe the customization steps of the image, like Image source etc. |
distribute | array | The distribution targets where the image output needs to go to. Required. |
errorHandling | object | Error handling options upon a build failure. |
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. |
identity | object | The identity of the image template, if configured. Required. |
lastRunStatus | object | State of 'run' that is currently executing or was last executed. |
location | string | The geo-location where the resource lives. Required. |
managedResourceTags | object | Tags that will be applied to the resource group and/or resources created by the service. |
optimize | object | Specifies optimization to be performed on image. |
provisioningError | object | Provisioning error, if any. |
provisioningState | string | Provisioning state of the resource. Known values are: "Creating", "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". (Creating, Updating, Succeeded, Failed, Deleting, Canceled) |
source | object | Specifies the properties used to describe the source image. Required. |
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. |
systemData | object | 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". |
validate | object | Configuration options and list of validations to be performed on the resulting image. |
vmProfile | object | Describes how virtual machine is set up to build images. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
additionalDataDisks | array | Optional array of additional data disks to be added to the image. |
autoRun | object | Indicates whether or not to automatically run the image template build on template creation or update. |
buildTimeoutInMinutes | integer | 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). |
customize | array | Specifies the properties used to describe the customization steps of the image, like Image source etc. |
distribute | array | The distribution targets where the image output needs to go to. Required. |
errorHandling | object | Error handling options upon a build failure. |
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. |
identity | object | The identity of the image template, if configured. Required. |
lastRunStatus | object | State of 'run' that is currently executing or was last executed. |
location | string | The geo-location where the resource lives. Required. |
managedResourceTags | object | Tags that will be applied to the resource group and/or resources created by the service. |
optimize | object | Specifies optimization to be performed on image. |
provisioningError | object | Provisioning error, if any. |
provisioningState | string | Provisioning state of the resource. Known values are: "Creating", "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". (Creating, Updating, Succeeded, Failed, Deleting, Canceled) |
source | object | Specifies the properties used to describe the source image. Required. |
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. |
systemData | object | 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". |
validate | object | Configuration options and list of validations to be performed on the resulting image. |
vmProfile | object | Describes how virtual machine is set up to build images. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
additionalDataDisks | array | Optional array of additional data disks to be added to the image. |
autoRun | object | Indicates whether or not to automatically run the image template build on template creation or update. |
buildTimeoutInMinutes | integer | 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). |
customize | array | Specifies the properties used to describe the customization steps of the image, like Image source etc. |
distribute | array | The distribution targets where the image output needs to go to. Required. |
errorHandling | object | Error handling options upon a build failure. |
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. |
identity | object | The identity of the image template, if configured. Required. |
lastRunStatus | object | State of 'run' that is currently executing or was last executed. |
location | string | The geo-location where the resource lives. Required. |
managedResourceTags | object | Tags that will be applied to the resource group and/or resources created by the service. |
optimize | object | Specifies optimization to be performed on image. |
provisioningError | object | Provisioning error, if any. |
provisioningState | string | Provisioning state of the resource. Known values are: "Creating", "Updating", "Succeeded", "Failed", "Deleting", and "Canceled". (Creating, Updating, Succeeded, Failed, Deleting, Canceled) |
source | object | Specifies the properties used to describe the source image. Required. |
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. |
systemData | object | 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". |
validate | object | Configuration options and list of validations to be performed on the resulting image. |
vmProfile | object | Describes how virtual machine is set up to build images. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_run_output | select | resource_group_name, image_template_name, run_output_name, subscription_id | Get the specified run output for the specified image template resource. | |
get | select | resource_group_name, image_template_name, subscription_id | Get information about a virtual machine image template. | |
list_by_resource_group | select | resource_group_name, subscription_id | Gets information about the VM image templates associated with the specified resource group. | |
list | select | subscription_id | Gets information about the VM image templates associated with the subscription. | |
create_or_update | insert | resource_group_name, image_template_name, subscription_id, location, identity | Create or update a virtual machine image template. | |
update | update | resource_group_name, image_template_name, subscription_id | Update the tags for this Virtual Machine Image Template. | |
create_or_update | replace | resource_group_name, image_template_name, subscription_id, location, identity | Create or update a virtual machine image template. | |
delete | delete | resource_group_name, image_template_name, subscription_id | Delete a virtual machine image template. | |
list_run_outputs | exec | resource_group_name, image_template_name, subscription_id | List all run outputs for the specified Image Template resource. | |
run | exec | resource_group_name, image_template_name, subscription_id | Create artifacts from a existing image template. | |
cancel | exec | resource_group_name, image_template_name, subscription_id | Cancel the long running image build based on the image template. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
image_template_name | string | The name of the image Template. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
run_output_name | string | The name of the run output. Required. |
subscription_id | string |
SELECT examples
- get_run_output
- get
- list_by_resource_group
- list
Get the specified run output for the specified image template resource.
SELECT
id,
name,
artifactId,
artifactUri,
provisioningState,
systemData,
type
FROM azure.image_builder.virtual_machine_image_templates
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND image_template_name = '{{ image_template_name }}' -- required
AND run_output_name = '{{ run_output_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Get information about a virtual machine image template.
SELECT
id,
name,
additionalDataDisks,
autoRun,
buildTimeoutInMinutes,
customize,
distribute,
errorHandling,
exactStagingResourceGroup,
identity,
lastRunStatus,
location,
managedResourceTags,
optimize,
provisioningError,
provisioningState,
source,
stagingResourceGroup,
systemData,
tags,
type,
validate,
vmProfile
FROM azure.image_builder.virtual_machine_image_templates
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND image_template_name = '{{ image_template_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Gets information about the VM image templates associated with the specified resource group.
SELECT
id,
name,
additionalDataDisks,
autoRun,
buildTimeoutInMinutes,
customize,
distribute,
errorHandling,
exactStagingResourceGroup,
identity,
lastRunStatus,
location,
managedResourceTags,
optimize,
provisioningError,
provisioningState,
source,
stagingResourceGroup,
systemData,
tags,
type,
validate,
vmProfile
FROM azure.image_builder.virtual_machine_image_templates
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Gets information about the VM image templates associated with the subscription.
SELECT
id,
name,
additionalDataDisks,
autoRun,
buildTimeoutInMinutes,
customize,
distribute,
errorHandling,
exactStagingResourceGroup,
identity,
lastRunStatus,
location,
managedResourceTags,
optimize,
provisioningError,
provisioningState,
source,
stagingResourceGroup,
systemData,
tags,
type,
validate,
vmProfile
FROM azure.image_builder.virtual_machine_image_templates
WHERE subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
Create or update a virtual machine image template.
INSERT INTO azure.image_builder.virtual_machine_image_templates (
tags,
location,
properties,
identity,
resource_group_name,
image_template_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ identity }}' /* required */,
'{{ resource_group_name }}',
'{{ image_template_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
identity,
location,
properties,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: virtual_machine_image_templates
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the virtual_machine_image_templates resource.
- name: image_template_name
value: "{{ image_template_name }}"
description: Required parameter for the virtual_machine_image_templates resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the virtual_machine_image_templates resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
The properties of the image template.
value:
source:
type: "{{ type }}"
customize:
- type: "{{ type }}"
name: "{{ name }}"
optimize:
vmBoot:
state: "{{ state }}"
workload:
state: "{{ state }}"
scriptUri: "{{ scriptUri }}"
sha256Checksum: "{{ sha256Checksum }}"
validate:
continueDistributeOnFailure: {{ continueDistributeOnFailure }}
sourceValidationOnly: {{ sourceValidationOnly }}
inVMValidations:
- type: "{{ type }}"
name: "{{ name }}"
distribute:
- type: "{{ type }}"
runOutputName: "{{ runOutputName }}"
artifactTags: "{{ artifactTags }}"
errorHandling:
onCustomizerError: "{{ onCustomizerError }}"
onValidationError: "{{ onValidationError }}"
provisioningState: "{{ provisioningState }}"
provisioningError:
provisioningErrorCode: "{{ provisioningErrorCode }}"
message: "{{ message }}"
lastRunStatus:
startTime: "{{ startTime }}"
endTime: "{{ endTime }}"
runState: "{{ runState }}"
runSubState: "{{ runSubState }}"
message: "{{ message }}"
buildTimeoutInMinutes: {{ buildTimeoutInMinutes }}
vmProfile:
vmSize: "{{ vmSize }}"
osDiskSizeGB: {{ osDiskSizeGB }}
userAssignedIdentities:
- "{{ userAssignedIdentities }}"
vnetConfig:
subnetId: "{{ subnetId }}"
containerInstanceSubnetId: "{{ containerInstanceSubnetId }}"
proxyVmSize: "{{ proxyVmSize }}"
additionalDataDisks:
- sizeGB: {{ sizeGB }}
stagingResourceGroup: "{{ stagingResourceGroup }}"
exactStagingResourceGroup: "{{ exactStagingResourceGroup }}"
autoRun:
state: "{{ state }}"
managedResourceTags: "{{ managedResourceTags }}"
- name: identity
description: |
The identity of the image template, if configured. Required.
value:
type: "{{ type }}"
userAssignedIdentities: "{{ userAssignedIdentities }}"
UPDATE examples
- update
Update the tags for this Virtual Machine Image Template.
UPDATE azure.image_builder.virtual_machine_image_templates
SET
identity = '{{ identity }}',
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND image_template_name = '{{ image_template_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
identity,
location,
properties,
systemData,
tags,
type;
REPLACE examples
- create_or_update
Create or update a virtual machine image template.
REPLACE azure.image_builder.virtual_machine_image_templates
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
identity = '{{ identity }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND image_template_name = '{{ image_template_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
AND identity = '{{ identity }}' --required
RETURNING
id,
name,
identity,
location,
properties,
systemData,
tags,
type;
DELETE examples
- delete
Delete a virtual machine image template.
DELETE FROM azure.image_builder.virtual_machine_image_templates
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND image_template_name = '{{ image_template_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;
Lifecycle Methods
- list_run_outputs
- run
- cancel
List all run outputs for the specified Image Template resource.
EXEC azure.image_builder.virtual_machine_image_templates.list_run_outputs
@resource_group_name='{{ resource_group_name }}' --required,
@image_template_name='{{ image_template_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Create artifacts from a existing image template.
EXEC azure.image_builder.virtual_machine_image_templates.run
@resource_group_name='{{ resource_group_name }}' --required,
@image_template_name='{{ image_template_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Cancel the long running image build based on the image template.
EXEC azure.image_builder.virtual_machine_image_templates.cancel
@resource_group_name='{{ resource_group_name }}' --required,
@image_template_name='{{ image_template_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;