1. Packages
  2. Azure Classic
  3. API Docs
  4. automation
  5. VariableObject

We recommend using Azure Native.

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

azure.automation.VariableObject

Explore with Pulumi AI

Manages an object variable in Azure Automation

Example Usage

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

const example = new azure.core.ResourceGroup("example", {
    name: "tfex-example-rg",
    location: "West Europe",
});
const exampleAccount = new azure.automation.Account("example", {
    name: "tfex-example-account",
    location: example.location,
    resourceGroupName: example.name,
    skuName: "Basic",
});
const exampleVariableObject = new azure.automation.VariableObject("example", {
    name: "tfex-example-var",
    resourceGroupName: example.name,
    automationAccountName: exampleAccount.name,
    value: JSON.stringify({
        greeting: "Hello, Terraform Basic Test.",
        language: "en",
    }),
});
Copy
import pulumi
import json
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="tfex-example-rg",
    location="West Europe")
example_account = azure.automation.Account("example",
    name="tfex-example-account",
    location=example.location,
    resource_group_name=example.name,
    sku_name="Basic")
example_variable_object = azure.automation.VariableObject("example",
    name="tfex-example-var",
    resource_group_name=example.name,
    automation_account_name=example_account.name,
    value=json.dumps({
        "greeting": "Hello, Terraform Basic Test.",
        "language": "en",
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/automation"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("tfex-example-rg"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := automation.NewAccount(ctx, "example", &automation.AccountArgs{
			Name:              pulumi.String("tfex-example-account"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			SkuName:           pulumi.String("Basic"),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"greeting": "Hello, Terraform Basic Test.",
			"language": "en",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = automation.NewVariableObject(ctx, "example", &automation.VariableObjectArgs{
			Name:                  pulumi.String("tfex-example-var"),
			ResourceGroupName:     example.Name,
			AutomationAccountName: exampleAccount.Name,
			Value:                 pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "tfex-example-rg",
        Location = "West Europe",
    });

    var exampleAccount = new Azure.Automation.Account("example", new()
    {
        Name = "tfex-example-account",
        Location = example.Location,
        ResourceGroupName = example.Name,
        SkuName = "Basic",
    });

    var exampleVariableObject = new Azure.Automation.VariableObject("example", new()
    {
        Name = "tfex-example-var",
        ResourceGroupName = example.Name,
        AutomationAccountName = exampleAccount.Name,
        Value = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["greeting"] = "Hello, Terraform Basic Test.",
            ["language"] = "en",
        }),
    });

});
Copy
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.automation.Account;
import com.pulumi.azure.automation.AccountArgs;
import com.pulumi.azure.automation.VariableObject;
import com.pulumi.azure.automation.VariableObjectArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("tfex-example-rg")
            .location("West Europe")
            .build());

        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
            .name("tfex-example-account")
            .location(example.location())
            .resourceGroupName(example.name())
            .skuName("Basic")
            .build());

        var exampleVariableObject = new VariableObject("exampleVariableObject", VariableObjectArgs.builder()
            .name("tfex-example-var")
            .resourceGroupName(example.name())
            .automationAccountName(exampleAccount.name())
            .value(serializeJson(
                jsonObject(
                    jsonProperty("greeting", "Hello, Terraform Basic Test."),
                    jsonProperty("language", "en")
                )))
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: tfex-example-rg
      location: West Europe
  exampleAccount:
    type: azure:automation:Account
    name: example
    properties:
      name: tfex-example-account
      location: ${example.location}
      resourceGroupName: ${example.name}
      skuName: Basic
  exampleVariableObject:
    type: azure:automation:VariableObject
    name: example
    properties:
      name: tfex-example-var
      resourceGroupName: ${example.name}
      automationAccountName: ${exampleAccount.name}
      value:
        fn::toJSON:
          greeting: Hello, Terraform Basic Test.
          language: en
Copy

Create VariableObject Resource

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

Constructor syntax

new VariableObject(name: string, args: VariableObjectArgs, opts?: CustomResourceOptions);
@overload
def VariableObject(resource_name: str,
                   args: VariableObjectArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def VariableObject(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   automation_account_name: Optional[str] = None,
                   resource_group_name: Optional[str] = None,
                   description: Optional[str] = None,
                   encrypted: Optional[bool] = None,
                   name: Optional[str] = None,
                   value: Optional[str] = None)
func NewVariableObject(ctx *Context, name string, args VariableObjectArgs, opts ...ResourceOption) (*VariableObject, error)
public VariableObject(string name, VariableObjectArgs args, CustomResourceOptions? opts = null)
public VariableObject(String name, VariableObjectArgs args)
public VariableObject(String name, VariableObjectArgs args, CustomResourceOptions options)
type: azure:automation:VariableObject
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VariableObjectArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VariableObjectArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VariableObjectArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VariableObjectArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VariableObjectArgs
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 variableObjectResource = new Azure.Automation.VariableObject("variableObjectResource", new()
{
    AutomationAccountName = "string",
    ResourceGroupName = "string",
    Description = "string",
    Encrypted = false,
    Name = "string",
    Value = "string",
});
Copy
example, err := automation.NewVariableObject(ctx, "variableObjectResource", &automation.VariableObjectArgs{
	AutomationAccountName: pulumi.String("string"),
	ResourceGroupName:     pulumi.String("string"),
	Description:           pulumi.String("string"),
	Encrypted:             pulumi.Bool(false),
	Name:                  pulumi.String("string"),
	Value:                 pulumi.String("string"),
})
Copy
var variableObjectResource = new VariableObject("variableObjectResource", VariableObjectArgs.builder()
    .automationAccountName("string")
    .resourceGroupName("string")
    .description("string")
    .encrypted(false)
    .name("string")
    .value("string")
    .build());
Copy
variable_object_resource = azure.automation.VariableObject("variableObjectResource",
    automation_account_name="string",
    resource_group_name="string",
    description="string",
    encrypted=False,
    name="string",
    value="string")
Copy
const variableObjectResource = new azure.automation.VariableObject("variableObjectResource", {
    automationAccountName: "string",
    resourceGroupName: "string",
    description: "string",
    encrypted: false,
    name: "string",
    value: "string",
});
Copy
type: azure:automation:VariableObject
properties:
    automationAccountName: string
    description: string
    encrypted: false
    name: string
    resourceGroupName: string
    value: string
Copy

VariableObject 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 VariableObject resource accepts the following input properties:

AutomationAccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
Description string
The description of the Automation Variable.
Encrypted bool
Specifies if the Automation Variable is encrypted. Defaults to false.
Name Changes to this property will trigger replacement. string
The name of the Automation Variable. Changing this forces a new resource to be created.
Value string
The value of the Automation Variable as a jsonencode() string.
AutomationAccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
Description string
The description of the Automation Variable.
Encrypted bool
Specifies if the Automation Variable is encrypted. Defaults to false.
Name Changes to this property will trigger replacement. string
The name of the Automation Variable. Changing this forces a new resource to be created.
Value string
The value of the Automation Variable as a jsonencode() string.
automationAccountName
This property is required.
Changes to this property will trigger replacement.
String
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
description String
The description of the Automation Variable.
encrypted Boolean
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. String
The name of the Automation Variable. Changing this forces a new resource to be created.
value String
The value of the Automation Variable as a jsonencode() string.
automationAccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
description string
The description of the Automation Variable.
encrypted boolean
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. string
The name of the Automation Variable. Changing this forces a new resource to be created.
value string
The value of the Automation Variable as a jsonencode() string.
automation_account_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
description str
The description of the Automation Variable.
encrypted bool
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. str
The name of the Automation Variable. Changing this forces a new resource to be created.
value str
The value of the Automation Variable as a jsonencode() string.
automationAccountName
This property is required.
Changes to this property will trigger replacement.
String
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
description String
The description of the Automation Variable.
encrypted Boolean
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. String
The name of the Automation Variable. Changing this forces a new resource to be created.
value String
The value of the Automation Variable as a jsonencode() string.

Outputs

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

Get an existing VariableObject 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?: VariableObjectState, opts?: CustomResourceOptions): VariableObject
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        automation_account_name: Optional[str] = None,
        description: Optional[str] = None,
        encrypted: Optional[bool] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        value: Optional[str] = None) -> VariableObject
func GetVariableObject(ctx *Context, name string, id IDInput, state *VariableObjectState, opts ...ResourceOption) (*VariableObject, error)
public static VariableObject Get(string name, Input<string> id, VariableObjectState? state, CustomResourceOptions? opts = null)
public static VariableObject get(String name, Output<String> id, VariableObjectState state, CustomResourceOptions options)
resources:  _:    type: azure:automation:VariableObject    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AutomationAccountName Changes to this property will trigger replacement. string
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
Description string
The description of the Automation Variable.
Encrypted bool
Specifies if the Automation Variable is encrypted. Defaults to false.
Name Changes to this property will trigger replacement. string
The name of the Automation Variable. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
Value string
The value of the Automation Variable as a jsonencode() string.
AutomationAccountName Changes to this property will trigger replacement. string
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
Description string
The description of the Automation Variable.
Encrypted bool
Specifies if the Automation Variable is encrypted. Defaults to false.
Name Changes to this property will trigger replacement. string
The name of the Automation Variable. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
Value string
The value of the Automation Variable as a jsonencode() string.
automationAccountName Changes to this property will trigger replacement. String
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
description String
The description of the Automation Variable.
encrypted Boolean
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. String
The name of the Automation Variable. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
value String
The value of the Automation Variable as a jsonencode() string.
automationAccountName Changes to this property will trigger replacement. string
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
description string
The description of the Automation Variable.
encrypted boolean
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. string
The name of the Automation Variable. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
value string
The value of the Automation Variable as a jsonencode() string.
automation_account_name Changes to this property will trigger replacement. str
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
description str
The description of the Automation Variable.
encrypted bool
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. str
The name of the Automation Variable. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
value str
The value of the Automation Variable as a jsonencode() string.
automationAccountName Changes to this property will trigger replacement. String
The name of the automation account in which the Variable is created. Changing this forces a new resource to be created.
description String
The description of the Automation Variable.
encrypted Boolean
Specifies if the Automation Variable is encrypted. Defaults to false.
name Changes to this property will trigger replacement. String
The name of the Automation Variable. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the Automation Variable. Changing this forces a new resource to be created.
value String
The value of the Automation Variable as a jsonencode() string.

Import

Automation Object Variable can be imported using the resource id, e.g.

$ pulumi import azure:automation/variableObject:VariableObject example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tfex-example-rg/providers/Microsoft.Automation/automationAccounts/tfex-example-account/variables/tfex-example-var
Copy

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.