Azure Classic v5.43.0, May 6 23
Azure Classic v5.43.0, May 6 23
azure.compute.Image
Explore with Pulumi AI
Manages a custom virtual machine image that can be used to create virtual machines.
Example Usage
Creating From VHD
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var exampleNetworkInterface = new Azure.Network.NetworkInterface("exampleNetworkInterface", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
IpConfigurations = new[]
{
new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
{
Name = "testconfiguration1",
PrivateIpAddressAllocation = "Static",
},
},
});
var exampleVirtualMachine = new Azure.Compute.VirtualMachine("exampleVirtualMachine", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
NetworkInterfaceIds = new[]
{
exampleNetworkInterface.Id,
},
VmSize = "Standard_D1_v2",
StorageOsDisk = new Azure.Compute.Inputs.VirtualMachineStorageOsDiskArgs
{
Name = "myosdisk1",
CreateOption = "FromImage",
},
});
var exampleImage = new Azure.Compute.Image("exampleImage", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
OsDisk = new Azure.Compute.Inputs.ImageOsDiskArgs
{
OsType = "Linux",
OsState = "Generalized",
BlobUri = exampleVirtualMachine.StorageOsDisk.Apply(storageOsDisk => storageOsDisk.VhdUri),
SizeGb = 30,
},
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleNetworkInterface, err := network.NewNetworkInterface(ctx, "exampleNetworkInterface", &network.NetworkInterfaceArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
&network.NetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("testconfiguration1"),
PrivateIpAddressAllocation: pulumi.String("Static"),
},
},
})
if err != nil {
return err
}
exampleVirtualMachine, err := compute.NewVirtualMachine(ctx, "exampleVirtualMachine", &compute.VirtualMachineArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
NetworkInterfaceIds: pulumi.StringArray{
exampleNetworkInterface.ID(),
},
VmSize: pulumi.String("Standard_D1_v2"),
StorageOsDisk: &compute.VirtualMachineStorageOsDiskArgs{
Name: pulumi.String("myosdisk1"),
CreateOption: pulumi.String("FromImage"),
},
})
if err != nil {
return err
}
_, err = compute.NewImage(ctx, "exampleImage", &compute.ImageArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
OsDisk: &compute.ImageOsDiskArgs{
OsType: pulumi.String("Linux"),
OsState: pulumi.String("Generalized"),
BlobUri: exampleVirtualMachine.StorageOsDisk.ApplyT(func(storageOsDisk compute.VirtualMachineStorageOsDisk) (*string, error) {
return &storageOsDisk.VhdUri, nil
}).(pulumi.StringPtrOutput),
SizeGb: pulumi.Int(30),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.NetworkInterface;
import com.pulumi.azure.network.NetworkInterfaceArgs;
import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
import com.pulumi.azure.compute.VirtualMachine;
import com.pulumi.azure.compute.VirtualMachineArgs;
import com.pulumi.azure.compute.inputs.VirtualMachineStorageOsDiskArgs;
import com.pulumi.azure.compute.Image;
import com.pulumi.azure.compute.ImageArgs;
import com.pulumi.azure.compute.inputs.ImageOsDiskArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
.name("testconfiguration1")
.privateIpAddressAllocation("Static")
.build())
.build());
var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.networkInterfaceIds(exampleNetworkInterface.id())
.vmSize("Standard_D1_v2")
.storageOsDisk(VirtualMachineStorageOsDiskArgs.builder()
.name("myosdisk1")
.createOption("FromImage")
.build())
.build());
var exampleImage = new Image("exampleImage", ImageArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.osDisk(ImageOsDiskArgs.builder()
.osType("Linux")
.osState("Generalized")
.blobUri(exampleVirtualMachine.storageOsDisk().applyValue(storageOsDisk -> storageOsDisk.vhdUri()))
.sizeGb(30)
.build())
.build());
}
}
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_network_interface = azure.network.NetworkInterface("exampleNetworkInterface",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
ip_configurations=[azure.network.NetworkInterfaceIpConfigurationArgs(
name="testconfiguration1",
private_ip_address_allocation="Static",
)])
example_virtual_machine = azure.compute.VirtualMachine("exampleVirtualMachine",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
network_interface_ids=[example_network_interface.id],
vm_size="Standard_D1_v2",
storage_os_disk=azure.compute.VirtualMachineStorageOsDiskArgs(
name="myosdisk1",
create_option="FromImage",
))
example_image = azure.compute.Image("exampleImage",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
os_disk=azure.compute.ImageOsDiskArgs(
os_type="Linux",
os_state="Generalized",
blob_uri=example_virtual_machine.storage_os_disk.vhd_uri,
size_gb=30,
))
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleNetworkInterface = new azure.network.NetworkInterface("exampleNetworkInterface", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
ipConfigurations: [{
name: "testconfiguration1",
privateIpAddressAllocation: "Static",
}],
});
const exampleVirtualMachine = new azure.compute.VirtualMachine("exampleVirtualMachine", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
networkInterfaceIds: [exampleNetworkInterface.id],
vmSize: "Standard_D1_v2",
storageOsDisk: {
name: "myosdisk1",
createOption: "FromImage",
},
});
const exampleImage = new azure.compute.Image("exampleImage", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
osDisk: {
osType: "Linux",
osState: "Generalized",
blobUri: exampleVirtualMachine.storageOsDisk.apply(storageOsDisk => storageOsDisk.vhdUri),
sizeGb: 30,
},
});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
exampleNetworkInterface:
type: azure:network:NetworkInterface
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
ipConfigurations:
- name: testconfiguration1
privateIpAddressAllocation: Static
exampleVirtualMachine:
type: azure:compute:VirtualMachine
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
networkInterfaceIds:
- ${exampleNetworkInterface.id}
vmSize: Standard_D1_v2
storageOsDisk:
name: myosdisk1
createOption: FromImage
exampleImage:
type: azure:compute:Image
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
osDisk:
osType: Linux
osState: Generalized
blobUri: ${exampleVirtualMachine.storageOsDisk.vhdUri}
sizeGb: 30
Creating From Virtual Machine (VM Must Be Generalized Beforehand)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var exampleNetworkInterface = new Azure.Network.NetworkInterface("exampleNetworkInterface", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
IpConfigurations = new[]
{
new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
{
Name = "testconfiguration1",
PrivateIpAddressAllocation = "Static",
},
},
});
var exampleVirtualMachine = new Azure.Compute.VirtualMachine("exampleVirtualMachine", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
NetworkInterfaceIds = new[]
{
exampleNetworkInterface.Id,
},
VmSize = "Standard_D1_v2",
StorageOsDisk = new Azure.Compute.Inputs.VirtualMachineStorageOsDiskArgs
{
Name = "myosdisk1",
CreateOption = "FromImage",
},
});
var exampleImage = new Azure.Compute.Image("exampleImage", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
SourceVirtualMachineId = exampleVirtualMachine.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleNetworkInterface, err := network.NewNetworkInterface(ctx, "exampleNetworkInterface", &network.NetworkInterfaceArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
IpConfigurations: network.NetworkInterfaceIpConfigurationArray{
&network.NetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("testconfiguration1"),
PrivateIpAddressAllocation: pulumi.String("Static"),
},
},
})
if err != nil {
return err
}
exampleVirtualMachine, err := compute.NewVirtualMachine(ctx, "exampleVirtualMachine", &compute.VirtualMachineArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
NetworkInterfaceIds: pulumi.StringArray{
exampleNetworkInterface.ID(),
},
VmSize: pulumi.String("Standard_D1_v2"),
StorageOsDisk: &compute.VirtualMachineStorageOsDiskArgs{
Name: pulumi.String("myosdisk1"),
CreateOption: pulumi.String("FromImage"),
},
})
if err != nil {
return err
}
_, err = compute.NewImage(ctx, "exampleImage", &compute.ImageArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
SourceVirtualMachineId: exampleVirtualMachine.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.NetworkInterface;
import com.pulumi.azure.network.NetworkInterfaceArgs;
import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
import com.pulumi.azure.compute.VirtualMachine;
import com.pulumi.azure.compute.VirtualMachineArgs;
import com.pulumi.azure.compute.inputs.VirtualMachineStorageOsDiskArgs;
import com.pulumi.azure.compute.Image;
import com.pulumi.azure.compute.ImageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
.name("testconfiguration1")
.privateIpAddressAllocation("Static")
.build())
.build());
var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.networkInterfaceIds(exampleNetworkInterface.id())
.vmSize("Standard_D1_v2")
.storageOsDisk(VirtualMachineStorageOsDiskArgs.builder()
.name("myosdisk1")
.createOption("FromImage")
.build())
.build());
var exampleImage = new Image("exampleImage", ImageArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.sourceVirtualMachineId(exampleVirtualMachine.id())
.build());
}
}
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_network_interface = azure.network.NetworkInterface("exampleNetworkInterface",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
ip_configurations=[azure.network.NetworkInterfaceIpConfigurationArgs(
name="testconfiguration1",
private_ip_address_allocation="Static",
)])
example_virtual_machine = azure.compute.VirtualMachine("exampleVirtualMachine",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
network_interface_ids=[example_network_interface.id],
vm_size="Standard_D1_v2",
storage_os_disk=azure.compute.VirtualMachineStorageOsDiskArgs(
name="myosdisk1",
create_option="FromImage",
))
example_image = azure.compute.Image("exampleImage",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
source_virtual_machine_id=example_virtual_machine.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleNetworkInterface = new azure.network.NetworkInterface("exampleNetworkInterface", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
ipConfigurations: [{
name: "testconfiguration1",
privateIpAddressAllocation: "Static",
}],
});
const exampleVirtualMachine = new azure.compute.VirtualMachine("exampleVirtualMachine", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
networkInterfaceIds: [exampleNetworkInterface.id],
vmSize: "Standard_D1_v2",
storageOsDisk: {
name: "myosdisk1",
createOption: "FromImage",
},
});
const exampleImage = new azure.compute.Image("exampleImage", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
sourceVirtualMachineId: exampleVirtualMachine.id,
});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
exampleNetworkInterface:
type: azure:network:NetworkInterface
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
ipConfigurations:
- name: testconfiguration1
privateIpAddressAllocation: Static
exampleVirtualMachine:
type: azure:compute:VirtualMachine
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
networkInterfaceIds:
- ${exampleNetworkInterface.id}
vmSize: Standard_D1_v2
storageOsDisk:
name: myosdisk1
createOption: FromImage
exampleImage:
type: azure:compute:Image
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
sourceVirtualMachineId: ${exampleVirtualMachine.id}
Create Image Resource
new Image(name: string, args: ImageArgs, opts?: CustomResourceOptions);
@overload
def Image(resource_name: str,
opts: Optional[ResourceOptions] = None,
data_disks: Optional[Sequence[ImageDataDiskArgs]] = None,
hyper_v_generation: Optional[str] = None,
location: Optional[str] = None,
name: Optional[str] = None,
os_disk: Optional[ImageOsDiskArgs] = None,
resource_group_name: Optional[str] = None,
source_virtual_machine_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
zone_resilient: Optional[bool] = None)
@overload
def Image(resource_name: str,
args: ImageArgs,
opts: Optional[ResourceOptions] = None)
func NewImage(ctx *Context, name string, args ImageArgs, opts ...ResourceOption) (*Image, error)
public Image(string name, ImageArgs args, CustomResourceOptions? opts = null)
type: azure:compute:Image
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args ImageArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args ImageArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The Image resource accepts the following input properties:
- Resource
Group stringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- Data
Disks List<ImageData Disk Args> One or more
data_disk
elements as defined below.- Hyper
VGeneration string The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- Location string
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- Os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- Source
Virtual stringMachine Id The Virtual Machine ID from which to create the image.
- Dictionary<string, string>
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.
- Resource
Group stringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- Data
Disks []ImageData Disk Args One or more
data_disk
elements as defined below.- Hyper
VGeneration string The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- Location string
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- Os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- Source
Virtual stringMachine Id The Virtual Machine ID from which to create the image.
- map[string]string
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.
- resource
Group StringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- data
Disks List<ImageData Disk Args> One or more
data_disk
elements as defined below.- hyper
VGeneration String The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location String
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- source
Virtual StringMachine Id The Virtual Machine ID from which to create the image.
- Map<String,String>
A mapping of tags to assign to the resource.
- zone
Resilient Boolean Is zone resiliency enabled? Defaults to
false
. Changing this forces a new resource to be created.
- resource
Group stringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- data
Disks ImageData Disk Args[] One or more
data_disk
elements as defined below.- hyper
VGeneration string The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location string
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- source
Virtual stringMachine Id The Virtual Machine ID from which to create the image.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- zone
Resilient boolean Is zone resiliency enabled? Defaults to
false
. Changing this forces a new resource to be created.
- resource_
group_ strname The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- data_
disks Sequence[ImageData Disk Args] One or more
data_disk
elements as defined below.- hyper_
v_ strgeneration The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location str
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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 ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- source_
virtual_ strmachine_ id The Virtual Machine ID from which to create the image.
- Mapping[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.
- resource
Group StringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- data
Disks List<Property Map> One or more
data_disk
elements as defined below.- hyper
VGeneration String The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location String
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- os
Disk Property Map One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- source
Virtual StringMachine Id The Virtual Machine ID from which to create the image.
- Map<String>
A mapping of tags to assign to the resource.
- zone
Resilient Boolean 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 string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up 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
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
data_disks: Optional[Sequence[ImageDataDiskArgs]] = None,
hyper_v_generation: Optional[str] = None,
location: Optional[str] = None,
name: Optional[str] = None,
os_disk: Optional[ImageOsDiskArgs] = None,
resource_group_name: Optional[str] = None,
source_virtual_machine_id: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
zone_resilient: Optional[bool] = None) -> Image
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)
public static Image get(String name, Output<String> id, ImageState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Data
Disks List<ImageData Disk Args> One or more
data_disk
elements as defined below.- Hyper
VGeneration string The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- Location string
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- Os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- Resource
Group stringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- Source
Virtual stringMachine Id The Virtual Machine ID from which to create the image.
- Dictionary<string, string>
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.
- Data
Disks []ImageData Disk Args One or more
data_disk
elements as defined below.- Hyper
VGeneration string The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- Location string
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- Os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- Resource
Group stringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- Source
Virtual stringMachine Id The Virtual Machine ID from which to create the image.
- map[string]string
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.
- data
Disks List<ImageData Disk Args> One or more
data_disk
elements as defined below.- hyper
VGeneration String The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location String
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- resource
Group StringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- source
Virtual StringMachine Id The Virtual Machine ID from which to create the image.
- Map<String,String>
A mapping of tags to assign to the resource.
- zone
Resilient Boolean Is zone resiliency enabled? Defaults to
false
. Changing this forces a new resource to be created.
- data
Disks ImageData Disk Args[] One or more
data_disk
elements as defined below.- hyper
VGeneration string The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location string
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- os
Disk ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- resource
Group stringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- source
Virtual stringMachine Id The Virtual Machine ID from which to create the image.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- zone
Resilient boolean Is zone resiliency enabled? Defaults to
false
. Changing this forces a new resource to be created.
- data_
disks Sequence[ImageData Disk Args] One or more
data_disk
elements as defined below.- hyper_
v_ strgeneration The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location str
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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 ImageOs Disk Args One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- resource_
group_ strname The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- source_
virtual_ strmachine_ id The Virtual Machine ID from which to create the image.
- Mapping[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.
- data
Disks List<Property Map> One or more
data_disk
elements as defined below.- hyper
VGeneration String The HyperVGenerationType of the VirtualMachine created from the image as
V1
,V2
. The default isV1
. Changing this forces a new resource to be created.- location String
Specified the supported Azure location where the resource exists. Changing this forces a new resource to be created. 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.
- os
Disk Property Map One or more
os_disk
elements as defined below. Changing this forces a new resource to be created.- resource
Group StringName The name of the resource group in which to create. Changing this forces a new resource to be created. the image. Changing this forces a new resource to be created.
- source
Virtual StringMachine Id The Virtual Machine ID from which to create the image.
- Map<String>
A mapping of tags to assign to the resource.
- zone
Resilient Boolean Is zone resiliency enabled? Defaults to
false
. Changing this forces a new resource to be created.
Supporting Types
ImageDataDisk
- Blob
Uri 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
, orNone
. The default isNone
.- Lun int
Specifies the logical unit number of the data disk.
- Managed
Disk stringId Specifies the ID of the managed disk resource that you want to use to create the image. Changing this forces a new resource to be created.
- Size
Gb int Specifies the size of the image to be created. The target size can't be smaller than the source size.
- Blob
Uri 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
, orNone
. The default isNone
.- Lun int
Specifies the logical unit number of the data disk.
- Managed
Disk stringId Specifies the ID of the managed disk resource that you want to use to create the image. Changing this forces a new resource to be created.
- Size
Gb int Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob
Uri 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
, orNone
. The default isNone
.- lun Integer
Specifies the logical unit number of the data disk.
- managed
Disk StringId Specifies the ID of the managed disk resource that you want to use to create the image. Changing this forces a new resource to be created.
- size
Gb Integer Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob
Uri 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
, orNone
. The default isNone
.- lun number
Specifies the logical unit number of the data disk.
- managed
Disk stringId Specifies the ID of the managed disk resource that you want to use to create the image. Changing this forces a new resource to be created.
- size
Gb number Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob_
uri 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
, orNone
. The default isNone
.- lun int
Specifies the logical unit number of the data disk.
- managed_
disk_ strid Specifies the ID of the managed disk resource that you want to use to create the image. Changing this forces a new resource to be created.
- size_
gb int Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob
Uri 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
, orNone
. The default isNone
.- lun Number
Specifies the logical unit number of the data disk.
- managed
Disk StringId Specifies the ID of the managed disk resource that you want to use to create the image. Changing this forces a new resource to be created.
- size
Gb Number Specifies the size of the image to be created. The target size can't be smaller than the source size.
ImageOsDisk
- Blob
Uri string Specifies the URI in Azure storage of the blob that you want to use to create the image. Changing this forces a new resource to be created.
- Caching string
Specifies the caching mode as
ReadWrite
,ReadOnly
, orNone
. The default isNone
.- Managed
Disk stringId Specifies the ID of the managed disk resource that you want to use to create the image.
- Os
State string Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized. Possible values are
Generalized
andSpecialized
.- Os
Type string Specifies the type of operating system contained in the virtual machine image. Possible values are:
Windows
orLinux
.- Size
Gb int Specifies the size of the image to be created. The target size can't be smaller than the source size.
- Blob
Uri string Specifies the URI in Azure storage of the blob that you want to use to create the image. Changing this forces a new resource to be created.
- Caching string
Specifies the caching mode as
ReadWrite
,ReadOnly
, orNone
. The default isNone
.- Managed
Disk stringId Specifies the ID of the managed disk resource that you want to use to create the image.
- Os
State string Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized. Possible values are
Generalized
andSpecialized
.- Os
Type string Specifies the type of operating system contained in the virtual machine image. Possible values are:
Windows
orLinux
.- Size
Gb int Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob
Uri String Specifies the URI in Azure storage of the blob that you want to use to create the image. Changing this forces a new resource to be created.
- caching String
Specifies the caching mode as
ReadWrite
,ReadOnly
, orNone
. The default isNone
.- managed
Disk StringId Specifies the ID of the managed disk resource that you want to use to create the image.
- os
State String Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized. Possible values are
Generalized
andSpecialized
.- os
Type String Specifies the type of operating system contained in the virtual machine image. Possible values are:
Windows
orLinux
.- size
Gb Integer Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob
Uri string Specifies the URI in Azure storage of the blob that you want to use to create the image. Changing this forces a new resource to be created.
- caching string
Specifies the caching mode as
ReadWrite
,ReadOnly
, orNone
. The default isNone
.- managed
Disk stringId Specifies the ID of the managed disk resource that you want to use to create the image.
- os
State string Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized. Possible values are
Generalized
andSpecialized
.- os
Type string Specifies the type of operating system contained in the virtual machine image. Possible values are:
Windows
orLinux
.- size
Gb number Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob_
uri str Specifies the URI in Azure storage of the blob that you want to use to create the image. Changing this forces a new resource to be created.
- caching str
Specifies the caching mode as
ReadWrite
,ReadOnly
, orNone
. The default isNone
.- managed_
disk_ strid Specifies the ID of the managed disk resource that you want to use to create the image.
- os_
state str Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized. Possible values are
Generalized
andSpecialized
.- os_
type str Specifies the type of operating system contained in the virtual machine image. Possible values are:
Windows
orLinux
.- size_
gb int Specifies the size of the image to be created. The target size can't be smaller than the source size.
- blob
Uri String Specifies the URI in Azure storage of the blob that you want to use to create the image. Changing this forces a new resource to be created.
- caching String
Specifies the caching mode as
ReadWrite
,ReadOnly
, orNone
. The default isNone
.- managed
Disk StringId Specifies the ID of the managed disk resource that you want to use to create the image.
- os
State String Specifies the state of the operating system contained in the blob. Currently, the only value is Generalized. Possible values are
Generalized
andSpecialized
.- os
Type String Specifies the type of operating system contained in the virtual machine image. Possible values are:
Windows
orLinux
.- size
Gb Number Specifies the size of the image to be created. The target size can't be smaller than the source size.
Import
Images can be imported using the resource id
, e.g.
$ pulumi import azure:compute/image:Image example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/images/image1
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.