Images - Get

Gets an image.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}?api-version=2024-03-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}?$expand={$expand}&api-version=2024-03-01

URI Parameters

Name In Required Type Description
imageName
path True

string

The name of the image.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
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.

$expand
query

string

The expand expression to apply on the operation.

Responses

Name Type Description
200 OK

Image

OK

Other Status Codes

CloudError

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

Get information about a virtual machine image.

Sample Request

GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage?api-version=2024-03-01

Sample Response

{
  "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myImage",
  "name": "myImage",
  "type": "Microsoft.Compute/images",
  "location": "West US",
  "properties": {
    "storageProfile": {
      "osDisk": {
        "osType": "Windows",
        "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd",
        "snapshot": {
          "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1"
        },
        "managedDisk": {
          "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk1"
        },
        "osState": "Generalized",
        "storageAccountType": "Standard_LRS",
        "diskSizeGB": 20
      },
      "dataDisks": [
        {
          "lun": 1,
          "blobUri": "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd",
          "snapshot": {
            "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2"
          },
          "managedDisk": {
            "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2"
          },
          "storageAccountType": "Standard_LRS"
        }
      ],
      "zoneResilient": true
    },
    "provisioningState": "created"
  }
}

Definitions

Name Description
ApiError

Api error.

ApiErrorBase

Api error base.

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage.

CloudError

An error response from the Compute service.

DiskEncryptionSetParameters

Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details.

ExtendedLocation

The complex type of the extended location.

ExtendedLocationTypes

The type of the extended location.

HyperVGenerationTypes

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.

Image

The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.

ImageDataDisk

Describes a data disk.

ImageOSDisk

Describes an Operating System disk.

ImageStorageProfile

Describes a storage profile.

InnerError

Inner error details.

OperatingSystemStateTypes

The OS State. For managed images, use Generalized.

OperatingSystemTypes

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.

StorageAccountTypes

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.

SubResource

ApiError

Api error.

Name Type Description
code

string

The error code.

details

ApiErrorBase[]

The Api error details

innererror

InnerError

The Api inner error

message

string

The error message.

target

string

The target of the particular error.

ApiErrorBase

Api error base.

Name Type Description
code

string

The error code.

message

string

The error message.

target

string

The target of the particular error.

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage.

Name Type Description
None

string

ReadOnly

string

ReadWrite

string

CloudError

An error response from the Compute service.

Name Type Description
error

ApiError

Api error.

DiskEncryptionSetParameters

Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. Note: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details.

Name Type Description
id

string

Resource Id

ExtendedLocation

The complex type of the extended location.

Name Type Description
name

string

The name of the extended location.

type

ExtendedLocationTypes

The type of the extended location.

ExtendedLocationTypes

The type of the extended location.

Name Type Description
EdgeZone

string

HyperVGenerationTypes

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.

Name Type Description
V1

string

V2

string

Image

The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist.

Name Type Description
extendedLocation

ExtendedLocation

The extended location of the Image.

id

string

Resource Id

location

string

Resource location

name

string

Resource name

properties.hyperVGeneration

HyperVGenerationTypes

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.

properties.provisioningState

string

The provisioning state.

properties.sourceVirtualMachine

SubResource

The source virtual machine from which Image is created.

properties.storageProfile

ImageStorageProfile

Specifies the storage settings for the virtual machine disks.

tags

object

Resource tags

type

string

Resource type

ImageDataDisk

Describes a data disk.

Name Type Description
blobUri

string

The Virtual Hard Disk.

caching

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage.

diskEncryptionSet

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed image disk.

diskSizeGB

integer

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.

lun

integer

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.

managedDisk

SubResource

The managedDisk.

snapshot

SubResource

The snapshot.

storageAccountType

StorageAccountTypes

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.

ImageOSDisk

Describes an Operating System disk.

Name Type Description
blobUri

string

The Virtual Hard Disk.

caching

CachingTypes

Specifies the caching requirements. Possible values are: None, ReadOnly, ReadWrite. The default values are: None for Standard storage. ReadOnly for Premium storage.

diskEncryptionSet

DiskEncryptionSetParameters

Specifies the customer managed disk encryption set resource id for the managed image disk.

diskSizeGB

integer

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.

managedDisk

SubResource

The managedDisk.

osState

OperatingSystemStateTypes

The OS State. For managed images, use Generalized.

osType

OperatingSystemTypes

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.

snapshot

SubResource

The snapshot.

storageAccountType

StorageAccountTypes

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.

ImageStorageProfile

Describes a storage profile.

Name Type Description
dataDisks

ImageDataDisk[]

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.

osDisk

ImageOSDisk

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.

zoneResilient

boolean

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).

InnerError

Inner error details.

Name Type Description
errordetail

string

The internal error message or exception dump.

exceptiontype

string

The exception type.

OperatingSystemStateTypes

The OS State. For managed images, use Generalized.

Name Type Description
Generalized

string

Generalized image. Needs to be provisioned during deployment time.

Specialized

string

Specialized image. Contains already provisioned OS Disk.

OperatingSystemTypes

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.

Name Type Description
Linux

string

Windows

string

StorageAccountTypes

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.

Name Type Description
PremiumV2_LRS

string

Premium_LRS

string

Premium_ZRS

string

StandardSSD_LRS

string

StandardSSD_ZRS

string

Standard_LRS

string

UltraSSD_LRS

string

SubResource

Name Type Description
id

string

Resource Id