We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.compute.getImage
Explore with Pulumi AI
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/v6/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)
public static Output<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
fn::invoke:
  function: azure:compute/getImage:getImage
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ResourceGroup stringName 
- 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.
- ResourceGroup stringName 
- 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.
- resourceGroup StringName 
- 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.
- resourceGroup stringName 
- 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_ strname 
- 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.
- resourceGroup StringName 
- 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<GetImage Data Disk> 
- a collection of data_diskblocks 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<GetImage Os Disk> 
- a os_diskblock as defined below.
- ResourceGroup stringName 
- 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 []GetImage Data Disk 
- a collection of data_diskblocks as defined below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- the Azure Location where this Image exists.
- OsDisks []GetImage Os Disk 
- a os_diskblock as defined below.
- ResourceGroup stringName 
- 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<GetImage Data Disk> 
- a collection of data_diskblocks 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<GetImage Os Disk> 
- a os_diskblock as defined below.
- resourceGroup StringName 
- 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 GetImage Data Disk[] 
- a collection of data_diskblocks as defined below.
- id string
- The provider-assigned unique ID for this managed resource.
- location string
- the Azure Location where this Image exists.
- osDisks GetImage Os Disk[] 
- a os_diskblock as defined below.
- resourceGroup stringName 
- {[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[GetImage Data Disk] 
- a collection of data_diskblocks 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[GetImage Os Disk] 
- a os_diskblock as defined below.
- resource_group_ strname 
- 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_diskblocks 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_diskblock as defined below.
- resourceGroup StringName 
- 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, orNone.
- Lun int
- the logical unit number of the data disk.
- ManagedDisk stringId 
- 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, orNone.
- Lun int
- the logical unit number of the data disk.
- ManagedDisk stringId 
- 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, orNone.
- lun Integer
- the logical unit number of the data disk.
- managedDisk StringId 
- 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, orNone.
- lun number
- the logical unit number of the data disk.
- managedDisk stringId 
- 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, orNone.
- lun int
- the logical unit number of the data disk.
- managed_disk_ strid 
- 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, orNone.
- lun Number
- the logical unit number of the data disk.
- managedDisk StringId 
- 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, orNone.
- ManagedDisk stringId 
- 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 LinuxorWindows.
- 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, orNone.
- ManagedDisk stringId 
- 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 LinuxorWindows.
- 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, orNone.
- managedDisk StringId 
- 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 LinuxorWindows.
- 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, orNone.
- managedDisk stringId 
- 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 LinuxorWindows.
- 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, orNone.
- managed_disk_ strid 
- 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 LinuxorWindows.
- 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, orNone.
- managedDisk StringId 
- 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 LinuxorWindows.
- 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 azurermTerraform Provider.