New-​Azure​Automation​Variable

Creates an Automation variable.

Syntax

New-AzureAutomationVariable
   -AutomationAccountName <String>
   [-Description <String>]
   -Encrypted <Boolean>
   -Name <String>
   [-Profile <AzureSMProfile>]
   [-Value <Object>]
   [<CommonParameters>]

Description

The New-AzureAutomationVariable cmdlet creates a variable in Microsoft Azure Automation.

Examples

Example 1: Create a new variable with a simple value

PS C:\> New-AzureAutomationVariable -AutomationAccountName "Contoso17" -Name "MyStringVariable" -Encrypted $False -Value "My String"

This command creates a new variable named MyStringVariable with a string value in the Azure Automation account named Contoso17.

Example 2: Create a new variable with a complex value

PS C:\> $vm = Get-AzureVM -ServiceName "MyVM" -Name "MyVM"
PS C:\> New-AzureAutomationVariable -AutomationAccountName "Contoso17" -Name "MyComplexVariable" -Encrypted $False -Value $vm

These commands create a new variable called MyComplexVariable in the Automation account named Contoso17. A complex object is used for its value, in this case a virtual machine object.

Required Parameters

-AutomationAccountName

Specifies the name of the Automation account the variable will be stored in.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Encrypted

Indicates whether the value of the variable should be stored encrypted.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies a name for the variable.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Description

Specifies a description for the variable.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Value

Specifies a value to store in the variable.

Type:Object
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.Automation.Model.Variable