< Back

New-AzureRmAutomationVariable

Tue Jan 29, 2019 9:32 pm

NAME New-AzureRmAutomationVariable



SYNOPSIS

Creates an Automation variable.





SYNTAX

New-AzureRmAutomationVariable [-ResourceGroupName] <String> [-AutomationAccountName] <String> [-Name] <String> [-DefaultProfile

<IAzureContextContainer>] [-Description <String>] -Encrypted <Boolean> [-Value <Object>] [<CommonParameters>]





DESCRIPTION

The New-AzureRmAutomationVariable cmdlet creates a variable in Azure Automation. To encrypt the variable, specify the Encrypted parameter. You

cannot modify the encrypted state of a variable after creation.





PARAMETERS

-AutomationAccountName <String>

Specifies the name of the Automation account in which to store the variable.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Description <String>

Specifies a description for the variable.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Encrypted <Boolean>

Specifies whether this cmdlet encrypts the value of the variable for storage.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

Specifies a name for the variable.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>

Specifies the resource group for which this cmdlet creates a variable.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Value <Object>

Specifies a value for the variable.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Automation.Model.Variable







NOTES









Example 1: Create a variable with a simple value



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

-ResourceGroupName "ResourceGroup01"



This command creates a variable named StringVariable22 with a string value in the Automation account named Contoso17.





Example 2: Create a variable with a complex value



PS C:\\>$VirtualMachine = Get-AzureVM -ServiceName "VirtualMachine" -Name "VirtualMachine03"

PS C:\\> New-AzureRmAutomationVariable -AutomationAccountName "Contoso17" -Name "ComplexVariable01" -Encrypted $False -Value $VirtualMachine

-ResourceGroupName "ResourceGroup01"



The first command gets a virtual machine by using the Get-AzureVM cmdlet. The command stores it in the $VirtualMachine variable.



The second command creates a variable named ComplexVariable01 in the Automation account named Contoso17. This command uses a complex object for

its value, in this case, the virtual machine in $VirtualMachine.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... onvariable

Get-AzureRmAutomationVariable

Remove-AzureRmAutomationVariable

Set-AzureRmAutomationVariable