Image

Manages a custom virtual machine image that can be used to create virtual machines.

Example Usage

Creating From Virtual Machine (VM Must Be Generalized Beforehand)

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West US",
        });
        var exampleImage = new Azure.Compute.Image("exampleImage", new Azure.Compute.ImageArgs
        {
            Location = "West US",
            ResourceGroupName = exampleResourceGroup.Name,
            SourceVirtualMachineId = "{vm_id}",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/compute"
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
            Location: pulumi.String("West US"),
        })
        if err != nil {
            return err
        }
        _, err = compute.NewImage(ctx, "exampleImage", &compute.ImageArgs{
            Location:               pulumi.String("West US"),
            ResourceGroupName:      exampleResourceGroup.Name,
            SourceVirtualMachineId: pulumi.String("{vm_id}"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West US")
example_image = azure.compute.Image("exampleImage",
    location="West US",
    resource_group_name=example_resource_group.name,
    source_virtual_machine_id="{vm_id}")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West US"});
const exampleImage = new azure.compute.Image("exampleImage", {
    location: "West US",
    resourceGroupName: exampleResourceGroup.name,
    sourceVirtualMachineId: "{vm_id}",
});

Create a Image Resource

new Image(name: string, args: ImageArgs, opts?: CustomResourceOptions);
def Image(resource_name, opts=None, data_disks=None, hyper_v_generation=None, location=None, name=None, os_disk=None, resource_group_name=None, source_virtual_machine_id=None, tags=None, zone_resilient=None, __props__=None);
func NewImage(ctx *Context, name string, args ImageArgs, opts ...ResourceOption) (*Image, error)
public Image(string name, ImageArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ImageArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ImageArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Image Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Image resource accepts the following input properties:

ResourceGroupName string

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

DataDisks List<ImageDataDiskArgs>

One or more data_disk elements as defined below.

HyperVGeneration string

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

Location string

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the image. Changing this forces a new resource to be created.

OsDisk ImageOsDiskArgs

One or more os_disk elements as defined below.

SourceVirtualMachineId string

The Virtual Machine ID from which to create the image.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

ZoneResilient bool

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

DataDisks []ImageDataDisk

One or more data_disk elements as defined below.

HyperVGeneration string

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

Location string

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the image. Changing this forces a new resource to be created.

OsDisk ImageOsDisk

One or more os_disk elements as defined below.

SourceVirtualMachineId string

The Virtual Machine ID from which to create the image.

Tags map[string]string

A mapping of tags to assign to the resource.

ZoneResilient bool

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

dataDisks ImageDataDisk[]

One or more data_disk elements as defined below.

hyperVGeneration string

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

location string

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name string

Specifies the name of the image. Changing this forces a new resource to be created.

osDisk ImageOsDisk

One or more os_disk elements as defined below.

sourceVirtualMachineId string

The Virtual Machine ID from which to create the image.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

zoneResilient boolean

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

data_disks List[ImageDataDisk]

One or more data_disk elements as defined below.

hyper_v_generation str

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

location str

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name str

Specifies the name of the image. Changing this forces a new resource to be created.

os_disk Dict[ImageOsDisk]

One or more os_disk elements as defined below.

source_virtual_machine_id str

The Virtual Machine ID from which to create the image.

tags Dict[str, str]

A mapping of tags to assign to the resource.

zone_resilient bool

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the Image resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Image Resource

Get an existing Image resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ImageState, opts?: CustomResourceOptions): Image
static get(resource_name, id, opts=None, data_disks=None, hyper_v_generation=None, location=None, name=None, os_disk=None, resource_group_name=None, source_virtual_machine_id=None, tags=None, zone_resilient=None, __props__=None);
func GetImage(ctx *Context, name string, id IDInput, state *ImageState, opts ...ResourceOption) (*Image, error)
public static Image Get(string name, Input<string> id, ImageState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

DataDisks List<ImageDataDiskArgs>

One or more data_disk elements as defined below.

HyperVGeneration string

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

Location string

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the image. Changing this forces a new resource to be created.

OsDisk ImageOsDiskArgs

One or more os_disk elements as defined below.

ResourceGroupName string

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

SourceVirtualMachineId string

The Virtual Machine ID from which to create the image.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

ZoneResilient bool

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

DataDisks []ImageDataDisk

One or more data_disk elements as defined below.

HyperVGeneration string

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

Location string

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the image. Changing this forces a new resource to be created.

OsDisk ImageOsDisk

One or more os_disk elements as defined below.

ResourceGroupName string

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

SourceVirtualMachineId string

The Virtual Machine ID from which to create the image.

Tags map[string]string

A mapping of tags to assign to the resource.

ZoneResilient bool

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

dataDisks ImageDataDisk[]

One or more data_disk elements as defined below.

hyperVGeneration string

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

location string

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name string

Specifies the name of the image. Changing this forces a new resource to be created.

osDisk ImageOsDisk

One or more os_disk elements as defined below.

resourceGroupName string

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

sourceVirtualMachineId string

The Virtual Machine ID from which to create the image.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

zoneResilient boolean

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

data_disks List[ImageDataDisk]

One or more data_disk elements as defined below.

hyper_v_generation str

The HyperVGenerationType of the VirtualMachine created from the image as V1, V2. The default is V1.

location str

Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name str

Specifies the name of the image. Changing this forces a new resource to be created.

os_disk Dict[ImageOsDisk]

One or more os_disk elements as defined below.

resource_group_name str

The name of the resource group in which to create the image. Changing this forces a new resource to be created.

source_virtual_machine_id str

The Virtual Machine ID from which to create the image.

tags Dict[str, str]

A mapping of tags to assign to the resource.

zone_resilient bool

Is zone resiliency enabled? Defaults to false. Changing this forces a new resource to be created.

Supporting Types

ImageDataDisk

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

BlobUri string

Specifies the URI in Azure storage of the blob that you want to use to create the image.

Caching string

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

Lun int

Specifies the logical unit number of the data disk.

ManagedDiskId string

Specifies the ID of the managed disk resource that you want to use to create the image.

SizeGb int

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

BlobUri string

Specifies the URI in Azure storage of the blob that you want to use to create the image.

Caching string

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

Lun int

Specifies the logical unit number of the data disk.

ManagedDiskId string

Specifies the ID of the managed disk resource that you want to use to create the image.

SizeGb int

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

blobUri string

Specifies the URI in Azure storage of the blob that you want to use to create the image.

caching string

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

lun number

Specifies the logical unit number of the data disk.

managedDiskId string

Specifies the ID of the managed disk resource that you want to use to create the image.

sizeGb number

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

blobUri str

Specifies the URI in Azure storage of the blob that you want to use to create the image.

caching str

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

lun float

Specifies the logical unit number of the data disk.

managed_disk_id str

Specifies the ID of the managed disk resource that you want to use to create the image.

sizeGb float

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

ImageOsDisk

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

BlobUri string

Specifies the URI in Azure storage of the blob that you want to use to create the image.

Caching string

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

ManagedDiskId string

Specifies the ID of the managed disk resource that you want to use to create the image.

OsState string

Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized.

OsType string

Specifies the type of operating system contained in the virtual machine image. Possible values are: Windows or Linux.

SizeGb int

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

BlobUri string

Specifies the URI in Azure storage of the blob that you want to use to create the image.

Caching string

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

ManagedDiskId string

Specifies the ID of the managed disk resource that you want to use to create the image.

OsState string

Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized.

OsType string

Specifies the type of operating system contained in the virtual machine image. Possible values are: Windows or Linux.

SizeGb int

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

blobUri string

Specifies the URI in Azure storage of the blob that you want to use to create the image.

caching string

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

managedDiskId string

Specifies the ID of the managed disk resource that you want to use to create the image.

osState string

Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized.

osType string

Specifies the type of operating system contained in the virtual machine image. Possible values are: Windows or Linux.

sizeGb number

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

blobUri str

Specifies the URI in Azure storage of the blob that you want to use to create the image.

caching str

Specifies the caching mode as ReadWrite, ReadOnly, or None. The default is None.

managed_disk_id str

Specifies the ID of the managed disk resource that you want to use to create the image.

osState str

Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized.

os_type str

Specifies the type of operating system contained in the virtual machine image. Possible values are: Windows or Linux.

sizeGb float

Specifies the size of the image to be created. The target size can’t be smaller than the source size.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.