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

We recommend using Azure Native.

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

azure.automation.StringVariable

Explore with Pulumi AI

Manages a string 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 exampleStringVariable = new azure.automation.StringVariable("example", {
    name: "tfex-example-var",
    resourceGroupName: example.name,
    automationAccountName: exampleAccount.name,
    value: "Hello, Basic Test.",
});
Copy
import pulumi
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_string_variable = azure.automation.StringVariable("example",
    name="tfex-example-var",
    resource_group_name=example.name,
    automation_account_name=example_account.name,
    value="Hello, Basic Test.")
Copy
package main

import (
	"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
		}
		_, err = automation.NewStringVariable(ctx, "example", &automation.StringVariableArgs{
			Name:                  pulumi.String("tfex-example-var"),
			ResourceGroupName:     example.Name,
			AutomationAccountName: exampleAccount.Name,
			Value:                 pulumi.String("Hello, Basic Test."),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
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 exampleStringVariable = new Azure.Automation.StringVariable("example", new()
    {
        Name = "tfex-example-var",
        ResourceGroupName = example.Name,
        AutomationAccountName = exampleAccount.Name,
        Value = "Hello, Basic Test.",
    });

});
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.StringVariable;
import com.pulumi.azure.automation.StringVariableArgs;
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 exampleStringVariable = new StringVariable("exampleStringVariable", StringVariableArgs.builder()
            .name("tfex-example-var")
            .resourceGroupName(example.name())
            .automationAccountName(exampleAccount.name())
            .value("Hello, Basic Test.")
            .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
  exampleStringVariable:
    type: azure:automation:StringVariable
    name: example
    properties:
      name: tfex-example-var
      resourceGroupName: ${example.name}
      automationAccountName: ${exampleAccount.name}
      value: Hello, Basic Test.
Copy

Create StringVariable Resource

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

Constructor syntax

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

@overload
def StringVariable(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 NewStringVariable(ctx *Context, name string, args StringVariableArgs, opts ...ResourceOption) (*StringVariable, error)
public StringVariable(string name, StringVariableArgs args, CustomResourceOptions? opts = null)
public StringVariable(String name, StringVariableArgs args)
public StringVariable(String name, StringVariableArgs args, CustomResourceOptions options)
type: azure:automation:StringVariable
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. StringVariableArgs
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. StringVariableArgs
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. StringVariableArgs
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. StringVariableArgs
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. StringVariableArgs
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 stringVariableResource = new Azure.Automation.StringVariable("stringVariableResource", new()
{
    AutomationAccountName = "string",
    ResourceGroupName = "string",
    Description = "string",
    Encrypted = false,
    Name = "string",
    Value = "string",
});
Copy
example, err := automation.NewStringVariable(ctx, "stringVariableResource", &automation.StringVariableArgs{
	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 stringVariableResource = new StringVariable("stringVariableResource", StringVariableArgs.builder()
    .automationAccountName("string")
    .resourceGroupName("string")
    .description("string")
    .encrypted(false)
    .name("string")
    .value("string")
    .build());
Copy
string_variable_resource = azure.automation.StringVariable("stringVariableResource",
    automation_account_name="string",
    resource_group_name="string",
    description="string",
    encrypted=False,
    name="string",
    value="string")
Copy
const stringVariableResource = new azure.automation.StringVariable("stringVariableResource", {
    automationAccountName: "string",
    resourceGroupName: "string",
    description: "string",
    encrypted: false,
    name: "string",
    value: "string",
});
Copy
type: azure:automation:StringVariable
properties:
    automationAccountName: string
    description: string
    encrypted: false
    name: string
    resourceGroupName: string
    value: string
Copy

StringVariable 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 StringVariable 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 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 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 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 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 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 string.

Outputs

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

Get an existing StringVariable 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?: StringVariableState, opts?: CustomResourceOptions): StringVariable
@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) -> StringVariable
func GetStringVariable(ctx *Context, name string, id IDInput, state *StringVariableState, opts ...ResourceOption) (*StringVariable, error)
public static StringVariable Get(string name, Input<string> id, StringVariableState? state, CustomResourceOptions? opts = null)
public static StringVariable get(String name, Output<String> id, StringVariableState state, CustomResourceOptions options)
resources:  _:    type: azure:automation:StringVariable    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 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 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 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 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 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 string.

Import

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

$ pulumi import azure:automation/stringVariable:StringVariable 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.