1. Packages
  2. Azure Classic
  3. API Docs
  4. compute
  5. getImage

We recommend using Azure Native.

Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi

azure.compute.getImage

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi

    Use this data source to access information about an existing Image.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const search = azure.compute.getImage({
        name: "search-api",
        resourceGroupName: "packerimages",
    });
    export const imageId = search.then(search => search.id);
    
    import pulumi
    import pulumi_azure as azure
    
    search = azure.compute.get_image(name="search-api",
        resource_group_name="packerimages")
    pulumi.export("imageId", search.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		search, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
    			Name:              pulumi.StringRef("search-api"),
    			ResourceGroupName: "packerimages",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("imageId", search.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var search = Azure.Compute.GetImage.Invoke(new()
        {
            Name = "search-api",
            ResourceGroupName = "packerimages",
        });
    
        return new Dictionary<string, object?>
        {
            ["imageId"] = search.Apply(getImageResult => getImageResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.compute.ComputeFunctions;
    import com.pulumi.azure.compute.inputs.GetImageArgs;
    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) {
            final var search = ComputeFunctions.getImage(GetImageArgs.builder()
                .name("search-api")
                .resourceGroupName("packerimages")
                .build());
    
            ctx.export("imageId", search.applyValue(getImageResult -> getImageResult.id()));
        }
    }
    
    variables:
      search:
        fn::invoke:
          Function: azure:compute:getImage
          Arguments:
            name: search-api
            resourceGroupName: packerimages
    outputs:
      imageId: ${search.id}
    

    Using getImage

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getImage(args: GetImageArgs, opts?: InvokeOptions): Promise<GetImageResult>
    function getImageOutput(args: GetImageOutputArgs, opts?: InvokeOptions): Output<GetImageResult>
    def get_image(name: Optional[str] = None,
                  name_regex: Optional[str] = None,
                  resource_group_name: Optional[str] = None,
                  sort_descending: Optional[bool] = None,
                  opts: Optional[InvokeOptions] = None) -> GetImageResult
    def get_image_output(name: Optional[pulumi.Input[str]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  resource_group_name: Optional[pulumi.Input[str]] = None,
                  sort_descending: Optional[pulumi.Input[bool]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetImageResult]
    func LookupImage(ctx *Context, args *LookupImageArgs, opts ...InvokeOption) (*LookupImageResult, error)
    func LookupImageOutput(ctx *Context, args *LookupImageOutputArgs, opts ...InvokeOption) LookupImageResultOutput

    > Note: This function is named LookupImage in the Go SDK.

    public static class GetImage 
    {
        public static Task<GetImageResult> InvokeAsync(GetImageArgs args, InvokeOptions? opts = null)
        public static Output<GetImageResult> Invoke(GetImageInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:compute/getImage:getImage
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ResourceGroupName string
    The Name of the Resource Group where this Image exists.
    Name string
    The name of the Image.
    NameRegex string
    Regex pattern of the image to match.
    SortDescending bool
    By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
    ResourceGroupName string
    The Name of the Resource Group where this Image exists.
    Name string
    The name of the Image.
    NameRegex string
    Regex pattern of the image to match.
    SortDescending bool
    By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
    resourceGroupName String
    The Name of the Resource Group where this Image exists.
    name String
    The name of the Image.
    nameRegex String
    Regex pattern of the image to match.
    sortDescending Boolean
    By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
    resourceGroupName string
    The Name of the Resource Group where this Image exists.
    name string
    The name of the Image.
    nameRegex string
    Regex pattern of the image to match.
    sortDescending boolean
    By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
    resource_group_name str
    The Name of the Resource Group where this Image exists.
    name str
    The name of the Image.
    name_regex str
    Regex pattern of the image to match.
    sort_descending bool
    By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.
    resourceGroupName String
    The Name of the Resource Group where this Image exists.
    name String
    The name of the Image.
    nameRegex String
    Regex pattern of the image to match.
    sortDescending Boolean
    By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.

    getImage Result

    The following output properties are available:

    DataDisks List<GetImageDataDisk>
    a collection of data_disk blocks as defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    the Azure Location where this Image exists.
    OsDisks List<GetImageOsDisk>
    a os_disk block as defined below.
    ResourceGroupName string
    Tags Dictionary<string, string>
    a mapping of tags to assigned to the resource.
    ZoneResilient bool
    is zone resiliency enabled?
    Name string
    the name of the Image.
    NameRegex string
    SortDescending bool
    DataDisks []GetImageDataDisk
    a collection of data_disk blocks as defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    the Azure Location where this Image exists.
    OsDisks []GetImageOsDisk
    a os_disk block as defined below.
    ResourceGroupName string
    Tags map[string]string
    a mapping of tags to assigned to the resource.
    ZoneResilient bool
    is zone resiliency enabled?
    Name string
    the name of the Image.
    NameRegex string
    SortDescending bool
    dataDisks List<GetImageDataDisk>
    a collection of data_disk blocks as defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    the Azure Location where this Image exists.
    osDisks List<GetImageOsDisk>
    a os_disk block as defined below.
    resourceGroupName String
    tags Map<String,String>
    a mapping of tags to assigned to the resource.
    zoneResilient Boolean
    is zone resiliency enabled?
    name String
    the name of the Image.
    nameRegex String
    sortDescending Boolean
    dataDisks GetImageDataDisk[]
    a collection of data_disk blocks as defined below.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    the Azure Location where this Image exists.
    osDisks GetImageOsDisk[]
    a os_disk block as defined below.
    resourceGroupName string
    tags {[key: string]: string}
    a mapping of tags to assigned to the resource.
    zoneResilient boolean
    is zone resiliency enabled?
    name string
    the name of the Image.
    nameRegex string
    sortDescending boolean
    data_disks Sequence[GetImageDataDisk]
    a collection of data_disk blocks as defined below.
    id str
    The provider-assigned unique ID for this managed resource.
    location str
    the Azure Location where this Image exists.
    os_disks Sequence[GetImageOsDisk]
    a os_disk block as defined below.
    resource_group_name str
    tags Mapping[str, str]
    a mapping of tags to assigned to the resource.
    zone_resilient bool
    is zone resiliency enabled?
    name str
    the name of the Image.
    name_regex str
    sort_descending bool
    dataDisks List<Property Map>
    a collection of data_disk blocks as defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    the Azure Location where this Image exists.
    osDisks List<Property Map>
    a os_disk block as defined below.
    resourceGroupName String
    tags Map<String>
    a mapping of tags to assigned to the resource.
    zoneResilient Boolean
    is zone resiliency enabled?
    name String
    the name of the Image.
    nameRegex String
    sortDescending Boolean

    Supporting Types

    GetImageDataDisk

    BlobUri string
    the URI in Azure storage of the blob used to create the image.
    Caching string
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    Lun int
    the logical unit number of the data disk.
    ManagedDiskId string
    the ID of the Managed Disk used as the Data Disk Image.
    SizeGb int
    the size of this Data Disk in GB.
    BlobUri string
    the URI in Azure storage of the blob used to create the image.
    Caching string
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    Lun int
    the logical unit number of the data disk.
    ManagedDiskId string
    the ID of the Managed Disk used as the Data Disk Image.
    SizeGb int
    the size of this Data Disk in GB.
    blobUri String
    the URI in Azure storage of the blob used to create the image.
    caching String
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    lun Integer
    the logical unit number of the data disk.
    managedDiskId String
    the ID of the Managed Disk used as the Data Disk Image.
    sizeGb Integer
    the size of this Data Disk in GB.
    blobUri string
    the URI in Azure storage of the blob used to create the image.
    caching string
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    lun number
    the logical unit number of the data disk.
    managedDiskId string
    the ID of the Managed Disk used as the Data Disk Image.
    sizeGb number
    the size of this Data Disk in GB.
    blob_uri str
    the URI in Azure storage of the blob used to create the image.
    caching str
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    lun int
    the logical unit number of the data disk.
    managed_disk_id str
    the ID of the Managed Disk used as the Data Disk Image.
    size_gb int
    the size of this Data Disk in GB.
    blobUri String
    the URI in Azure storage of the blob used to create the image.
    caching String
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    lun Number
    the logical unit number of the data disk.
    managedDiskId String
    the ID of the Managed Disk used as the Data Disk Image.
    sizeGb Number
    the size of this Data Disk in GB.

    GetImageOsDisk

    BlobUri string
    the URI in Azure storage of the blob used to create the image.
    Caching string
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    ManagedDiskId string
    the ID of the Managed Disk used as the Data Disk Image.
    OsState string
    the State of the OS used in the Image, such as Generalized.
    OsType string
    the type of Operating System used on the OS Disk. such as Linux or Windows.
    SizeGb int
    the size of this Data Disk in GB.
    BlobUri string
    the URI in Azure storage of the blob used to create the image.
    Caching string
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    ManagedDiskId string
    the ID of the Managed Disk used as the Data Disk Image.
    OsState string
    the State of the OS used in the Image, such as Generalized.
    OsType string
    the type of Operating System used on the OS Disk. such as Linux or Windows.
    SizeGb int
    the size of this Data Disk in GB.
    blobUri String
    the URI in Azure storage of the blob used to create the image.
    caching String
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    managedDiskId String
    the ID of the Managed Disk used as the Data Disk Image.
    osState String
    the State of the OS used in the Image, such as Generalized.
    osType String
    the type of Operating System used on the OS Disk. such as Linux or Windows.
    sizeGb Integer
    the size of this Data Disk in GB.
    blobUri string
    the URI in Azure storage of the blob used to create the image.
    caching string
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    managedDiskId string
    the ID of the Managed Disk used as the Data Disk Image.
    osState string
    the State of the OS used in the Image, such as Generalized.
    osType string
    the type of Operating System used on the OS Disk. such as Linux or Windows.
    sizeGb number
    the size of this Data Disk in GB.
    blob_uri str
    the URI in Azure storage of the blob used to create the image.
    caching str
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    managed_disk_id str
    the ID of the Managed Disk used as the Data Disk Image.
    os_state str
    the State of the OS used in the Image, such as Generalized.
    os_type str
    the type of Operating System used on the OS Disk. such as Linux or Windows.
    size_gb int
    the size of this Data Disk in GB.
    blobUri String
    the URI in Azure storage of the blob used to create the image.
    caching String
    the caching mode for the Data Disk, such as ReadWrite, ReadOnly, or None.
    managedDiskId String
    the ID of the Managed Disk used as the Data Disk Image.
    osState String
    the State of the OS used in the Image, such as Generalized.
    osType String
    the type of Operating System used on the OS Disk. such as Linux or Windows.
    sizeGb Number
    the size of this Data Disk in GB.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.73.0 published on Monday, Apr 22, 2024 by Pulumi