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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.compute.getPlatformImage

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Use this data source to access information about a Platform Image.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.compute.getPlatformImage({
    location: "West Europe",
    publisher: "Canonical",
    offer: "0001-com-ubuntu-server-focal",
    sku: "20_04-lts",
});
export const id = example.then(example => example.id);
Copy
import pulumi
import pulumi_azure as azure

example = azure.compute.get_platform_image(location="West Europe",
    publisher="Canonical",
    offer="0001-com-ubuntu-server-focal",
    sku="20_04-lts")
pulumi.export("id", example.id)
Copy
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 {
		example, err := compute.GetPlatformImage(ctx, &compute.GetPlatformImageArgs{
			Location:  "West Europe",
			Publisher: "Canonical",
			Offer:     "0001-com-ubuntu-server-focal",
			Sku:       "20_04-lts",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", example.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.Compute.GetPlatformImage.Invoke(new()
    {
        Location = "West Europe",
        Publisher = "Canonical",
        Offer = "0001-com-ubuntu-server-focal",
        Sku = "20_04-lts",
    });

    return new Dictionary<string, object?>
    {
        ["id"] = example.Apply(getPlatformImageResult => getPlatformImageResult.Id),
    };
});
Copy
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.GetPlatformImageArgs;
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 example = ComputeFunctions.getPlatformImage(GetPlatformImageArgs.builder()
            .location("West Europe")
            .publisher("Canonical")
            .offer("0001-com-ubuntu-server-focal")
            .sku("20_04-lts")
            .build());

        ctx.export("id", example.applyValue(getPlatformImageResult -> getPlatformImageResult.id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:compute:getPlatformImage
      arguments:
        location: West Europe
        publisher: Canonical
        offer: 0001-com-ubuntu-server-focal
        sku: 20_04-lts
outputs:
  id: ${example.id}
Copy

Using getPlatformImage

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 getPlatformImage(args: GetPlatformImageArgs, opts?: InvokeOptions): Promise<GetPlatformImageResult>
function getPlatformImageOutput(args: GetPlatformImageOutputArgs, opts?: InvokeOptions): Output<GetPlatformImageResult>
Copy
def get_platform_image(location: Optional[str] = None,
                       offer: Optional[str] = None,
                       publisher: Optional[str] = None,
                       sku: Optional[str] = None,
                       version: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetPlatformImageResult
def get_platform_image_output(location: Optional[pulumi.Input[str]] = None,
                       offer: Optional[pulumi.Input[str]] = None,
                       publisher: Optional[pulumi.Input[str]] = None,
                       sku: Optional[pulumi.Input[str]] = None,
                       version: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetPlatformImageResult]
Copy
func GetPlatformImage(ctx *Context, args *GetPlatformImageArgs, opts ...InvokeOption) (*GetPlatformImageResult, error)
func GetPlatformImageOutput(ctx *Context, args *GetPlatformImageOutputArgs, opts ...InvokeOption) GetPlatformImageResultOutput
Copy

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

public static class GetPlatformImage 
{
    public static Task<GetPlatformImageResult> InvokeAsync(GetPlatformImageArgs args, InvokeOptions? opts = null)
    public static Output<GetPlatformImageResult> Invoke(GetPlatformImageInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetPlatformImageResult> getPlatformImage(GetPlatformImageArgs args, InvokeOptions options)
public static Output<GetPlatformImageResult> getPlatformImage(GetPlatformImageArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:compute/getPlatformImage:getPlatformImage
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Location
This property is required.
Changes to this property will trigger replacement.
string
Specifies the Location to pull information about this Platform Image from.
Offer This property is required. string
Specifies the Offer associated with the Platform Image.
Publisher This property is required. string
Specifies the Publisher associated with the Platform Image.
Sku This property is required. string
Specifies the SKU of the Platform Image.
Version string
The version of the Platform Image.
Location
This property is required.
Changes to this property will trigger replacement.
string
Specifies the Location to pull information about this Platform Image from.
Offer This property is required. string
Specifies the Offer associated with the Platform Image.
Publisher This property is required. string
Specifies the Publisher associated with the Platform Image.
Sku This property is required. string
Specifies the SKU of the Platform Image.
Version string
The version of the Platform Image.
location
This property is required.
Changes to this property will trigger replacement.
String
Specifies the Location to pull information about this Platform Image from.
offer This property is required. String
Specifies the Offer associated with the Platform Image.
publisher This property is required. String
Specifies the Publisher associated with the Platform Image.
sku This property is required. String
Specifies the SKU of the Platform Image.
version String
The version of the Platform Image.
location
This property is required.
Changes to this property will trigger replacement.
string
Specifies the Location to pull information about this Platform Image from.
offer This property is required. string
Specifies the Offer associated with the Platform Image.
publisher This property is required. string
Specifies the Publisher associated with the Platform Image.
sku This property is required. string
Specifies the SKU of the Platform Image.
version string
The version of the Platform Image.
location
This property is required.
Changes to this property will trigger replacement.
str
Specifies the Location to pull information about this Platform Image from.
offer This property is required. str
Specifies the Offer associated with the Platform Image.
publisher This property is required. str
Specifies the Publisher associated with the Platform Image.
sku This property is required. str
Specifies the SKU of the Platform Image.
version str
The version of the Platform Image.
location
This property is required.
Changes to this property will trigger replacement.
String
Specifies the Location to pull information about this Platform Image from.
offer This property is required. String
Specifies the Offer associated with the Platform Image.
publisher This property is required. String
Specifies the Publisher associated with the Platform Image.
sku This property is required. String
Specifies the SKU of the Platform Image.
version String
The version of the Platform Image.

getPlatformImage Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Location string
Offer string
Publisher string
Sku string
Version string
Id string
The provider-assigned unique ID for this managed resource.
Location string
Offer string
Publisher string
Sku string
Version string
id String
The provider-assigned unique ID for this managed resource.
location String
offer String
publisher String
sku String
version String
id string
The provider-assigned unique ID for this managed resource.
location string
offer string
publisher string
sku string
version string
id str
The provider-assigned unique ID for this managed resource.
location str
offer str
publisher str
sku str
version str
id String
The provider-assigned unique ID for this managed resource.
location String
offer String
publisher String
sku String
version String

Package Details

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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi