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

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages a Virtual Machine Extension to provide post deployment configuration and run automated tasks.

    NOTE: Custom Script Extensions for Linux & Windows require that the commandToExecute returns a 0 exit code to be classified as successfully deployed. You can achieve this by appending exit 0 to the end of your commandToExecute.

    NOTE: Custom Script Extensions require that the Azure Virtual Machine Guest Agent is running on the Virtual Machine.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("exampleVirtualNetwork", new Azure.Network.VirtualNetworkArgs
            {
                AddressSpaces = 
                {
                    "10.0.0.0/16",
                },
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
            });
            var exampleSubnet = new Azure.Network.Subnet("exampleSubnet", new Azure.Network.SubnetArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                VirtualNetworkName = exampleVirtualNetwork.Name,
                AddressPrefixes = 
                {
                    "10.0.2.0/24",
                },
            });
            var exampleNetworkInterface = new Azure.Network.NetworkInterface("exampleNetworkInterface", new Azure.Network.NetworkInterfaceArgs
            {
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
                IpConfigurations = 
                {
                    new Azure.Network.Inputs.NetworkInterfaceIpConfigurationArgs
                    {
                        Name = "testconfiguration1",
                        SubnetId = exampleSubnet.Id,
                        PrivateIpAddressAllocation = "Dynamic",
                    },
                },
            });
            var exampleAccount = new Azure.Storage.Account("exampleAccount", new Azure.Storage.AccountArgs
            {
                ResourceGroupName = exampleResourceGroup.Name,
                Location = exampleResourceGroup.Location,
                AccountTier = "Standard",
                AccountReplicationType = "LRS",
                Tags = 
                {
                    { "environment", "staging" },
                },
            });
            var exampleContainer = new Azure.Storage.Container("exampleContainer", new Azure.Storage.ContainerArgs
            {
                StorageAccountName = exampleAccount.Name,
                ContainerAccessType = "private",
            });
            var exampleVirtualMachine = new Azure.Compute.VirtualMachine("exampleVirtualMachine", new Azure.Compute.VirtualMachineArgs
            {
                Location = exampleResourceGroup.Location,
                ResourceGroupName = exampleResourceGroup.Name,
                NetworkInterfaceIds = 
                {
                    exampleNetworkInterface.Id,
                },
                VmSize = "Standard_F2",
                StorageImageReference = new Azure.Compute.Inputs.VirtualMachineStorageImageReferenceArgs
                {
                    Publisher = "Canonical",
                    Offer = "UbuntuServer",
                    Sku = "16.04-LTS",
                    Version = "latest",
                },
                StorageOsDisk = new Azure.Compute.Inputs.VirtualMachineStorageOsDiskArgs
                {
                    Name = "myosdisk1",
                    VhdUri = Output.Tuple(exampleAccount.PrimaryBlobEndpoint, exampleContainer.Name).Apply(values =>
                    {
                        var primaryBlobEndpoint = values.Item1;
                        var name = values.Item2;
                        return $"{primaryBlobEndpoint}{name}/myosdisk1.vhd";
                    }),
                    Caching = "ReadWrite",
                    CreateOption = "FromImage",
                },
                OsProfile = new Azure.Compute.Inputs.VirtualMachineOsProfileArgs
                {
                    ComputerName = "hostname",
                    AdminUsername = "testadmin",
                    AdminPassword = "Password1234!",
                },
                OsProfileLinuxConfig = new Azure.Compute.Inputs.VirtualMachineOsProfileLinuxConfigArgs
                {
                    DisablePasswordAuthentication = false,
                },
                Tags = 
                {
                    { "environment", "staging" },
                },
            });
            var exampleExtension = new Azure.Compute.Extension("exampleExtension", new Azure.Compute.ExtensionArgs
            {
                VirtualMachineId = exampleVirtualMachine.Id,
                Publisher = "Microsoft.Azure.Extensions",
                Type = "CustomScript",
                TypeHandlerVersion = "2.0",
                Settings = @"	{
    		""commandToExecute"": ""hostname && uptime""
    	}
    ",
                Tags = 
                {
                    { "environment", "Production" },
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/compute"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/network"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/storage"
    	"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
    		}
    		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "exampleVirtualNetwork", &network.VirtualNetworkArgs{
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("10.0.0.0/16"),
    			},
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    		})
    		if err != nil {
    			return err
    		}
    		exampleSubnet, err := network.NewSubnet(ctx, "exampleSubnet", &network.SubnetArgs{
    			ResourceGroupName:  exampleResourceGroup.Name,
    			VirtualNetworkName: exampleVirtualNetwork.Name,
    			AddressPrefixes: pulumi.StringArray{
    				pulumi.String("10.0.2.0/24"),
    			},
    		})
    		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"),
    					SubnetId:                   exampleSubnet.ID(),
    					PrivateIpAddressAllocation: pulumi.String("Dynamic"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
    			ResourceGroupName:      exampleResourceGroup.Name,
    			Location:               exampleResourceGroup.Location,
    			AccountTier:            pulumi.String("Standard"),
    			AccountReplicationType: pulumi.String("LRS"),
    			Tags: pulumi.StringMap{
    				"environment": pulumi.String("staging"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleContainer, err := storage.NewContainer(ctx, "exampleContainer", &storage.ContainerArgs{
    			StorageAccountName:  exampleAccount.Name,
    			ContainerAccessType: pulumi.String("private"),
    		})
    		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_F2"),
    			StorageImageReference: &compute.VirtualMachineStorageImageReferenceArgs{
    				Publisher: pulumi.String("Canonical"),
    				Offer:     pulumi.String("UbuntuServer"),
    				Sku:       pulumi.String("16.04-LTS"),
    				Version:   pulumi.String("latest"),
    			},
    			StorageOsDisk: &compute.VirtualMachineStorageOsDiskArgs{
    				Name: pulumi.String("myosdisk1"),
    				VhdUri: pulumi.All(exampleAccount.PrimaryBlobEndpoint, exampleContainer.Name).ApplyT(func(_args []interface{}) (string, error) {
    					primaryBlobEndpoint := _args[0].(string)
    					name := _args[1].(string)
    					return fmt.Sprintf("%v%v%v", primaryBlobEndpoint, name, "/myosdisk1.vhd"), nil
    				}).(pulumi.StringOutput),
    				Caching:      pulumi.String("ReadWrite"),
    				CreateOption: pulumi.String("FromImage"),
    			},
    			OsProfile: &compute.VirtualMachineOsProfileArgs{
    				ComputerName:  pulumi.String("hostname"),
    				AdminUsername: pulumi.String("testadmin"),
    				AdminPassword: pulumi.String("Password1234!"),
    			},
    			OsProfileLinuxConfig: &compute.VirtualMachineOsProfileLinuxConfigArgs{
    				DisablePasswordAuthentication: pulumi.Bool(false),
    			},
    			Tags: pulumi.StringMap{
    				"environment": pulumi.String("staging"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewExtension(ctx, "exampleExtension", &compute.ExtensionArgs{
    			VirtualMachineId:   exampleVirtualMachine.ID(),
    			Publisher:          pulumi.String("Microsoft.Azure.Extensions"),
    			Type:               pulumi.String("CustomScript"),
    			TypeHandlerVersion: pulumi.String("2.0"),
    			Settings: pulumi.String(fmt.Sprintf("%v%v%v", "	{\n", "		\"commandToExecute\": \"hostname && uptime\"\n", "	}\n")),
    			Tags: pulumi.StringMap{
    				"environment": pulumi.String("Production"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleVirtualNetwork = new azure.network.VirtualNetwork("exampleVirtualNetwork", {
        addressSpaces: ["10.0.0.0/16"],
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
    });
    const exampleSubnet = new azure.network.Subnet("exampleSubnet", {
        resourceGroupName: exampleResourceGroup.name,
        virtualNetworkName: exampleVirtualNetwork.name,
        addressPrefixes: ["10.0.2.0/24"],
    });
    const exampleNetworkInterface = new azure.network.NetworkInterface("exampleNetworkInterface", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        ipConfigurations: [{
            name: "testconfiguration1",
            subnetId: exampleSubnet.id,
            privateIpAddressAllocation: "Dynamic",
        }],
    });
    const exampleAccount = new azure.storage.Account("exampleAccount", {
        resourceGroupName: exampleResourceGroup.name,
        location: exampleResourceGroup.location,
        accountTier: "Standard",
        accountReplicationType: "LRS",
        tags: {
            environment: "staging",
        },
    });
    const exampleContainer = new azure.storage.Container("exampleContainer", {
        storageAccountName: exampleAccount.name,
        containerAccessType: "private",
    });
    const exampleVirtualMachine = new azure.compute.VirtualMachine("exampleVirtualMachine", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        networkInterfaceIds: [exampleNetworkInterface.id],
        vmSize: "Standard_F2",
        storageImageReference: {
            publisher: "Canonical",
            offer: "UbuntuServer",
            sku: "16.04-LTS",
            version: "latest",
        },
        storageOsDisk: {
            name: "myosdisk1",
            vhdUri: pulumi.interpolate`${exampleAccount.primaryBlobEndpoint}${exampleContainer.name}/myosdisk1.vhd`,
            caching: "ReadWrite",
            createOption: "FromImage",
        },
        osProfile: {
            computerName: "hostname",
            adminUsername: "testadmin",
            adminPassword: "Password1234!",
        },
        osProfileLinuxConfig: {
            disablePasswordAuthentication: false,
        },
        tags: {
            environment: "staging",
        },
    });
    const exampleExtension = new azure.compute.Extension("exampleExtension", {
        virtualMachineId: exampleVirtualMachine.id,
        publisher: "Microsoft.Azure.Extensions",
        type: "CustomScript",
        typeHandlerVersion: "2.0",
        settings: `	{
    		"commandToExecute": "hostname && uptime"
    	}
    `,
        tags: {
            environment: "Production",
        },
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_virtual_network = azure.network.VirtualNetwork("exampleVirtualNetwork",
        address_spaces=["10.0.0.0/16"],
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name)
    example_subnet = azure.network.Subnet("exampleSubnet",
        resource_group_name=example_resource_group.name,
        virtual_network_name=example_virtual_network.name,
        address_prefixes=["10.0.2.0/24"])
    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",
            subnet_id=example_subnet.id,
            private_ip_address_allocation="Dynamic",
        )])
    example_account = azure.storage.Account("exampleAccount",
        resource_group_name=example_resource_group.name,
        location=example_resource_group.location,
        account_tier="Standard",
        account_replication_type="LRS",
        tags={
            "environment": "staging",
        })
    example_container = azure.storage.Container("exampleContainer",
        storage_account_name=example_account.name,
        container_access_type="private")
    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_F2",
        storage_image_reference=azure.compute.VirtualMachineStorageImageReferenceArgs(
            publisher="Canonical",
            offer="UbuntuServer",
            sku="16.04-LTS",
            version="latest",
        ),
        storage_os_disk=azure.compute.VirtualMachineStorageOsDiskArgs(
            name="myosdisk1",
            vhd_uri=pulumi.Output.all(example_account.primary_blob_endpoint, example_container.name).apply(lambda primary_blob_endpoint, name: f"{primary_blob_endpoint}{name}/myosdisk1.vhd"),
            caching="ReadWrite",
            create_option="FromImage",
        ),
        os_profile=azure.compute.VirtualMachineOsProfileArgs(
            computer_name="hostname",
            admin_username="testadmin",
            admin_password="Password1234!",
        ),
        os_profile_linux_config=azure.compute.VirtualMachineOsProfileLinuxConfigArgs(
            disable_password_authentication=False,
        ),
        tags={
            "environment": "staging",
        })
    example_extension = azure.compute.Extension("exampleExtension",
        virtual_machine_id=example_virtual_machine.id,
        publisher="Microsoft.Azure.Extensions",
        type="CustomScript",
        type_handler_version="2.0",
        settings="""	{
    		"commandToExecute": "hostname && uptime"
    	}
    """,
        tags={
            "environment": "Production",
        })
    

    Example coming soon!

    Create Extension Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Extension(name: string, args: ExtensionArgs, opts?: CustomResourceOptions);
    @overload
    def Extension(resource_name: str,
                  args: ExtensionArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def Extension(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  publisher: Optional[str] = None,
                  type: Optional[str] = None,
                  type_handler_version: Optional[str] = None,
                  virtual_machine_id: Optional[str] = None,
                  auto_upgrade_minor_version: Optional[bool] = None,
                  automatic_upgrade_enabled: Optional[bool] = None,
                  name: Optional[str] = None,
                  protected_settings: Optional[str] = None,
                  settings: Optional[str] = None,
                  tags: Optional[Mapping[str, str]] = None)
    func NewExtension(ctx *Context, name string, args ExtensionArgs, opts ...ResourceOption) (*Extension, error)
    public Extension(string name, ExtensionArgs args, CustomResourceOptions? opts = null)
    public Extension(String name, ExtensionArgs args)
    public Extension(String name, ExtensionArgs args, CustomResourceOptions options)
    
    type: azure:compute:Extension
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ExtensionArgs
    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 ExtensionArgs
    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 ExtensionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ExtensionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ExtensionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var extensionResource = new Azure.Compute.Extension("extensionResource", new()
    {
        Publisher = "string",
        Type = "string",
        TypeHandlerVersion = "string",
        VirtualMachineId = "string",
        AutoUpgradeMinorVersion = false,
        AutomaticUpgradeEnabled = false,
        Name = "string",
        ProtectedSettings = "string",
        Settings = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := compute.NewExtension(ctx, "extensionResource", &compute.ExtensionArgs{
    	Publisher:               pulumi.String("string"),
    	Type:                    pulumi.String("string"),
    	TypeHandlerVersion:      pulumi.String("string"),
    	VirtualMachineId:        pulumi.String("string"),
    	AutoUpgradeMinorVersion: pulumi.Bool(false),
    	AutomaticUpgradeEnabled: pulumi.Bool(false),
    	Name:                    pulumi.String("string"),
    	ProtectedSettings:       pulumi.String("string"),
    	Settings:                pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var extensionResource = new Extension("extensionResource", ExtensionArgs.builder()
        .publisher("string")
        .type("string")
        .typeHandlerVersion("string")
        .virtualMachineId("string")
        .autoUpgradeMinorVersion(false)
        .automaticUpgradeEnabled(false)
        .name("string")
        .protectedSettings("string")
        .settings("string")
        .tags(Map.of("string", "string"))
        .build());
    
    extension_resource = azure.compute.Extension("extensionResource",
        publisher="string",
        type="string",
        type_handler_version="string",
        virtual_machine_id="string",
        auto_upgrade_minor_version=False,
        automatic_upgrade_enabled=False,
        name="string",
        protected_settings="string",
        settings="string",
        tags={
            "string": "string",
        })
    
    const extensionResource = new azure.compute.Extension("extensionResource", {
        publisher: "string",
        type: "string",
        typeHandlerVersion: "string",
        virtualMachineId: "string",
        autoUpgradeMinorVersion: false,
        automaticUpgradeEnabled: false,
        name: "string",
        protectedSettings: "string",
        settings: "string",
        tags: {
            string: "string",
        },
    });
    
    type: azure:compute:Extension
    properties:
        autoUpgradeMinorVersion: false
        automaticUpgradeEnabled: false
        name: string
        protectedSettings: string
        publisher: string
        settings: string
        tags:
            string: string
        type: string
        typeHandlerVersion: string
        virtualMachineId: string
    

    Extension Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Extension resource accepts the following input properties:

    Publisher string
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    Type string
    The type of extension, available types for a publisher can be found using the Azure CLI.
    TypeHandlerVersion string
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    VirtualMachineId string
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    AutoUpgradeMinorVersion bool
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    AutomaticUpgradeEnabled bool
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    Name string
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    ProtectedSettings string
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    Settings string
    The settings passed to the extension, these are specified as a JSON object in a string.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Publisher string
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    Type string
    The type of extension, available types for a publisher can be found using the Azure CLI.
    TypeHandlerVersion string
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    VirtualMachineId string
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    AutoUpgradeMinorVersion bool
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    AutomaticUpgradeEnabled bool
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    Name string
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    ProtectedSettings string
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    Settings string
    The settings passed to the extension, these are specified as a JSON object in a string.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    publisher String
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    type String
    The type of extension, available types for a publisher can be found using the Azure CLI.
    typeHandlerVersion String
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtualMachineId String
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    autoUpgradeMinorVersion Boolean
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automaticUpgradeEnabled Boolean
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name String
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protectedSettings String
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    settings String
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    publisher string
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    type string
    The type of extension, available types for a publisher can be found using the Azure CLI.
    typeHandlerVersion string
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtualMachineId string
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    autoUpgradeMinorVersion boolean
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automaticUpgradeEnabled boolean
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name string
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protectedSettings string
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    settings string
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    publisher str
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    type str
    The type of extension, available types for a publisher can be found using the Azure CLI.
    type_handler_version str
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtual_machine_id str
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    auto_upgrade_minor_version bool
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automatic_upgrade_enabled bool
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name str
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protected_settings str
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    settings str
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    publisher String
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    type String
    The type of extension, available types for a publisher can be found using the Azure CLI.
    typeHandlerVersion String
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtualMachineId String
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    autoUpgradeMinorVersion Boolean
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automaticUpgradeEnabled Boolean
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name String
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protectedSettings String
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    settings String
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags Map<String>
    A mapping of tags to assign to the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Extension 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 Extension Resource

    Get an existing Extension 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?: ExtensionState, opts?: CustomResourceOptions): Extension
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            auto_upgrade_minor_version: Optional[bool] = None,
            automatic_upgrade_enabled: Optional[bool] = None,
            name: Optional[str] = None,
            protected_settings: Optional[str] = None,
            publisher: Optional[str] = None,
            settings: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            type: Optional[str] = None,
            type_handler_version: Optional[str] = None,
            virtual_machine_id: Optional[str] = None) -> Extension
    func GetExtension(ctx *Context, name string, id IDInput, state *ExtensionState, opts ...ResourceOption) (*Extension, error)
    public static Extension Get(string name, Input<string> id, ExtensionState? state, CustomResourceOptions? opts = null)
    public static Extension get(String name, Output<String> id, ExtensionState state, CustomResourceOptions options)
    resources:  _:    type: azure:compute:Extension    get:      id: ${id}
    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.
    The following state arguments are supported:
    AutoUpgradeMinorVersion bool
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    AutomaticUpgradeEnabled bool
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    Name string
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    ProtectedSettings string
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    Publisher string
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    Settings string
    The settings passed to the extension, these are specified as a JSON object in a string.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Type string
    The type of extension, available types for a publisher can be found using the Azure CLI.
    TypeHandlerVersion string
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    VirtualMachineId string
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    AutoUpgradeMinorVersion bool
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    AutomaticUpgradeEnabled bool
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    Name string
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    ProtectedSettings string
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    Publisher string
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    Settings string
    The settings passed to the extension, these are specified as a JSON object in a string.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    Type string
    The type of extension, available types for a publisher can be found using the Azure CLI.
    TypeHandlerVersion string
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    VirtualMachineId string
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    autoUpgradeMinorVersion Boolean
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automaticUpgradeEnabled Boolean
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name String
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protectedSettings String
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    publisher String
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    settings String
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    type String
    The type of extension, available types for a publisher can be found using the Azure CLI.
    typeHandlerVersion String
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtualMachineId String
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    autoUpgradeMinorVersion boolean
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automaticUpgradeEnabled boolean
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name string
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protectedSettings string
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    publisher string
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    settings string
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    type string
    The type of extension, available types for a publisher can be found using the Azure CLI.
    typeHandlerVersion string
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtualMachineId string
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    auto_upgrade_minor_version bool
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automatic_upgrade_enabled bool
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name str
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protected_settings str
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    publisher str
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    settings str
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    type str
    The type of extension, available types for a publisher can be found using the Azure CLI.
    type_handler_version str
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtual_machine_id str
    The ID of the Virtual Machine. Changing this forces a new resource to be created
    autoUpgradeMinorVersion Boolean
    Specifies if the platform deploys the latest minor version update to the type_handler_version specified.
    automaticUpgradeEnabled Boolean
    Should the Extension be automatically updated whenever the Publisher releases a new version of this VM Extension? Defaults to false.
    name String
    The name of the virtual machine extension peering. Changing this forces a new resource to be created.
    protectedSettings String
    The protected_settings passed to the extension, like settings, these are specified as a JSON object in a string.
    publisher String
    The publisher of the extension, available publishers can be found by using the Azure CLI. Changing this forces a new resource to be created.
    settings String
    The settings passed to the extension, these are specified as a JSON object in a string.
    tags Map<String>
    A mapping of tags to assign to the resource.
    type String
    The type of extension, available types for a publisher can be found using the Azure CLI.
    typeHandlerVersion String
    Specifies the version of the extension to use, available versions can be found using the Azure CLI.
    virtualMachineId String
    The ID of the Virtual Machine. Changing this forces a new resource to be created

    Import

    Virtual Machine Extensions can be imported using the resource id, e.g.

     $ pulumi import azure:compute/extension:Extension example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/virtualMachines/myVM/extensions/extensionName
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.