Microsoft.Compute images 2023-03-01

Bicep resource definition

The images resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/images resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.Compute/images@2023-03-01' = {
  name: 'string'
  location: 'string'
  tags: {
    tagName1: 'tagValue1'
    tagName2: 'tagValue2'
  }
  extendedLocation: {
    name: 'string'
    type: 'EdgeZone'
  }
  properties: {
    hyperVGeneration: 'string'
    sourceVirtualMachine: {
      id: 'string'
    }
    storageProfile: {
      dataDisks: [
        {
          blobUri: 'string'
          caching: 'string'
          diskEncryptionSet: {
            id: 'string'
          }
          diskSizeGB: int
          lun: int
          managedDisk: {
            id: 'string'
          }
          snapshot: {
            id: 'string'
          }
          storageAccountType: 'string'
        }
      ]
      osDisk: {
        blobUri: 'string'
        caching: 'string'
        diskEncryptionSet: {
          id: 'string'
        }
        diskSizeGB: int
        managedDisk: {
          id: 'string'
        }
        osState: 'string'
        osType: 'string'
        snapshot: {
          id: 'string'
        }
        storageAccountType: 'string'
      }
      zoneResilient: bool
    }
  }
}

Property values

images

Name Description Value
name The resource name string (required)

Character limit: 1-80

Valid characters:
Alphanumerics, underscores, periods, and hyphens.

Start with alphanumeric. End with alphanumeric or underscore.
location Resource location string (required)
tags Resource tags Dictionary of tag names and values. See Tags in templates
extendedLocation The extended location of the Image. ExtendedLocation
properties Describes the properties of an Image. ImageProperties

ExtendedLocation

Name Description Value
name The name of the extended location. string
type The type of the extended location. 'EdgeZone'

ImageProperties

Name Description Value
hyperVGeneration Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. 'V1'
'V2'
sourceVirtualMachine The source virtual machine from which Image is created. SubResource
storageProfile Specifies the storage settings for the virtual machine disks. ImageStorageProfile

SubResource

Name Description Value
id Resource Id string

ImageStorageProfile

Name Description Value
dataDisks Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see About disks and VHDs for Azure virtual machines.
ImageDataDisk[]
osDisk Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see About disks and VHDs for Azure virtual machines.
ImageOSDisk
zoneResilient Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). bool

ImageDataDisk

Name Description Value
blobUri The Virtual Hard Disk. string
caching Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage. 'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSetParameters
diskSizeGB Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. int
lun Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. int (required)
managedDisk The managedDisk. SubResource
snapshot The snapshot. SubResource
storageAccountType Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. 'PremiumV2_LRS'
'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

DiskEncryptionSetParameters

Name Description Value
id Resource Id string

ImageOSDisk

Name Description Value
blobUri The Virtual Hard Disk. string
caching Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage. 'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSetParameters
diskSizeGB Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. int
managedDisk The managedDisk. SubResource
osState The OS State. For managed images, use Generalized. 'Generalized'
'Specialized' (required)
osType This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. Possible values are: Windows, Linux. 'Linux'
'Windows' (required)
snapshot The snapshot. SubResource
storageAccountType Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. 'PremiumV2_LRS'
'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
Create a VM from User Image

Deploy to Azure
This template allows you to create a Virtual Machines from a User image. This template also deploys a Virtual Network, Public IP addresses and a Network Interface.
Create a VM in a new or existing vnet from a generalized VHD

Deploy to Azure
This template creates a VM from a generalized VHD and let you connect it to a new or existing VNET that can reside in another Resource Group than the virtual machine
Deploy a VM Scale Set with a Linux custom image

Deploy to Azure
This template allows you to deploy a custom VM Linux image inside an Scale Set. These VMs are behind a load balancer with HTTP load balancing (by default on port 80). The example uses a custom script to do the application deployment and update, you may have to provide your custom script for your own update procedure. You will have to provide a generalized image of your VM in the same subscription and region where you create the VMSS.
Deploy a VM Scale Set with a Windows custom image

Deploy to Azure
This template allows you to deploy a simple VM Scale Set usng a custom Windows image. These VMs are behind a load balancer with HTTP load balancing (by default on port 80)

ARM template resource definition

The images resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.Compute/images resource, add the following JSON to your template.

{
  "type": "Microsoft.Compute/images",
  "apiVersion": "2023-03-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "extendedLocation": {
    "name": "string",
    "type": "EdgeZone"
  },
  "properties": {
    "hyperVGeneration": "string",
    "sourceVirtualMachine": {
      "id": "string"
    },
    "storageProfile": {
      "dataDisks": [
        {
          "blobUri": "string",
          "caching": "string",
          "diskEncryptionSet": {
            "id": "string"
          },
          "diskSizeGB": "int",
          "lun": "int",
          "managedDisk": {
            "id": "string"
          },
          "snapshot": {
            "id": "string"
          },
          "storageAccountType": "string"
        }
      ],
      "osDisk": {
        "blobUri": "string",
        "caching": "string",
        "diskEncryptionSet": {
          "id": "string"
        },
        "diskSizeGB": "int",
        "managedDisk": {
          "id": "string"
        },
        "osState": "string",
        "osType": "string",
        "snapshot": {
          "id": "string"
        },
        "storageAccountType": "string"
      },
      "zoneResilient": "bool"
    }
  }
}

Property values

images

Name Description Value
type The resource type 'Microsoft.Compute/images'
apiVersion The resource api version '2023-03-01'
name The resource name string (required)

Character limit: 1-80

Valid characters:
Alphanumerics, underscores, periods, and hyphens.

Start with alphanumeric. End with alphanumeric or underscore.
location Resource location string (required)
tags Resource tags Dictionary of tag names and values. See Tags in templates
extendedLocation The extended location of the Image. ExtendedLocation
properties Describes the properties of an Image. ImageProperties

ExtendedLocation

Name Description Value
name The name of the extended location. string
type The type of the extended location. 'EdgeZone'

ImageProperties

Name Description Value
hyperVGeneration Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. 'V1'
'V2'
sourceVirtualMachine The source virtual machine from which Image is created. SubResource
storageProfile Specifies the storage settings for the virtual machine disks. ImageStorageProfile

SubResource

Name Description Value
id Resource Id string

ImageStorageProfile

Name Description Value
dataDisks Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see About disks and VHDs for Azure virtual machines.
ImageDataDisk[]
osDisk Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see About disks and VHDs for Azure virtual machines.
ImageOSDisk
zoneResilient Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). bool

ImageDataDisk

Name Description Value
blobUri The Virtual Hard Disk. string
caching Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage. 'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSetParameters
diskSizeGB Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. int
lun Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. int (required)
managedDisk The managedDisk. SubResource
snapshot The snapshot. SubResource
storageAccountType Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. 'PremiumV2_LRS'
'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

DiskEncryptionSetParameters

Name Description Value
id Resource Id string

ImageOSDisk

Name Description Value
blobUri The Virtual Hard Disk. string
caching Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage. 'None'
'ReadOnly'
'ReadWrite'
diskEncryptionSet Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSetParameters
diskSizeGB Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. int
managedDisk The managedDisk. SubResource
osState The OS State. For managed images, use Generalized. 'Generalized'
'Specialized' (required)
osType This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. Possible values are: Windows, Linux. 'Linux'
'Windows' (required)
snapshot The snapshot. SubResource
storageAccountType Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. 'PremiumV2_LRS'
'Premium_LRS'
'Premium_ZRS'
'StandardSSD_LRS'
'StandardSSD_ZRS'
'Standard_LRS'
'UltraSSD_LRS'

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
Create a VM from User Image

Deploy to Azure
This template allows you to create a Virtual Machines from a User image. This template also deploys a Virtual Network, Public IP addresses and a Network Interface.
Create a VM in a new or existing vnet from a generalized VHD

Deploy to Azure
This template creates a VM from a generalized VHD and let you connect it to a new or existing VNET that can reside in another Resource Group than the virtual machine
Deploy a VM Scale Set with a Linux custom image

Deploy to Azure
This template allows you to deploy a custom VM Linux image inside an Scale Set. These VMs are behind a load balancer with HTTP load balancing (by default on port 80). The example uses a custom script to do the application deployment and update, you may have to provide your custom script for your own update procedure. You will have to provide a generalized image of your VM in the same subscription and region where you create the VMSS.
Deploy a VM Scale Set with a Windows custom image

Deploy to Azure
This template allows you to deploy a simple VM Scale Set usng a custom Windows image. These VMs are behind a load balancer with HTTP load balancing (by default on port 80)

Terraform (AzAPI provider) resource definition

The images 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.Compute/images resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Compute/images@2023-03-01"
  name = "string"
  location = "string"
  parent_id = "string"
  tags = {
    tagName1 = "tagValue1"
    tagName2 = "tagValue2"
  }
  body = jsonencode({
    properties = {
      hyperVGeneration = "string"
      sourceVirtualMachine = {
        id = "string"
      }
      storageProfile = {
        dataDisks = [
          {
            blobUri = "string"
            caching = "string"
            diskEncryptionSet = {
              id = "string"
            }
            diskSizeGB = int
            lun = int
            managedDisk = {
              id = "string"
            }
            snapshot = {
              id = "string"
            }
            storageAccountType = "string"
          }
        ]
        osDisk = {
          blobUri = "string"
          caching = "string"
          diskEncryptionSet = {
            id = "string"
          }
          diskSizeGB = int
          managedDisk = {
            id = "string"
          }
          osState = "string"
          osType = "string"
          snapshot = {
            id = "string"
          }
          storageAccountType = "string"
        }
        zoneResilient = bool
      }
    }
    extendedLocation = {
      name = "string"
      type = "EdgeZone"
    }
  })
}

Property values

images

Name Description Value
type The resource type "Microsoft.Compute/images@2023-03-01"
name The resource name string (required)

Character limit: 1-80

Valid characters:
Alphanumerics, underscores, periods, and hyphens.

Start with alphanumeric. End with alphanumeric or underscore.
location Resource location string (required)
parent_id To deploy to a resource group, use the ID of that resource group. string (required)
tags Resource tags Dictionary of tag names and values.
extendedLocation The extended location of the Image. ExtendedLocation
properties Describes the properties of an Image. ImageProperties

ExtendedLocation

Name Description Value
name The name of the extended location. string
type The type of the extended location. "EdgeZone"

ImageProperties

Name Description Value
hyperVGeneration Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. "V1"
"V2"
sourceVirtualMachine The source virtual machine from which Image is created. SubResource
storageProfile Specifies the storage settings for the virtual machine disks. ImageStorageProfile

SubResource

Name Description Value
id Resource Id string

ImageStorageProfile

Name Description Value
dataDisks Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see About disks and VHDs for Azure virtual machines.
ImageDataDisk[]
osDisk Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see About disks and VHDs for Azure virtual machines.
ImageOSDisk
zoneResilient Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). bool

ImageDataDisk

Name Description Value
blobUri The Virtual Hard Disk. string
caching Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage. "None"
"ReadOnly"
"ReadWrite"
diskEncryptionSet Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSetParameters
diskSizeGB Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. int
lun Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. int (required)
managedDisk The managedDisk. SubResource
snapshot The snapshot. SubResource
storageAccountType Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. "PremiumV2_LRS"
"Premium_LRS"
"Premium_ZRS"
"StandardSSD_LRS"
"StandardSSD_ZRS"
"Standard_LRS"
"UltraSSD_LRS"

DiskEncryptionSetParameters

Name Description Value
id Resource Id string

ImageOSDisk

Name Description Value
blobUri The Virtual Hard Disk. string
caching Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage. "None"
"ReadOnly"
"ReadWrite"
diskEncryptionSet Specifies the customer managed disk encryption set resource id for the managed image disk. DiskEncryptionSetParameters
diskSizeGB Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. This value cannot be larger than 1023 GB. int
managedDisk The managedDisk. SubResource
osState The OS State. For managed images, use Generalized. "Generalized"
"Specialized" (required)
osType This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. Possible values are: Windows, Linux. "Linux"
"Windows" (required)
snapshot The snapshot. SubResource
storageAccountType Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. "PremiumV2_LRS"
"Premium_LRS"
"Premium_ZRS"
"StandardSSD_LRS"
"StandardSSD_ZRS"
"Standard_LRS"
"UltraSSD_LRS"