Create a variable

 

Updated: May 26, 2016

The Create a variable task creates a variable asset for any data you wish to store.

Variable names must be unique within an automation account.

The related Windows PowerShell cmdlet for this task is New-AzureRmAutomationVariable.

To specify the request, replace {subscription-id} with your subscription ID, {resource-group-name} with the name of your resource group, {automation-account-name} with the name of the automation account, and {variable-name} with the name of the variable.

Method

Request URI

PUT

https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Automation/automationAccounts/{automation-account-name}/variables/{variable-name}?api-version=2015-10-31

URI parameter

Description

api-version

Required. Valid values include 2015-10-31

The following code shows an example of the request body.

{
   "properties":{
      "description":"Variable that keeps a current tally",
      "isEncrypted":0,
      "type": "integer",
      "value": 41
   }
}

Element name

Required

Type

Description

Description

No

String

Specifies a description for the variable.

Encrypted

Yes

Boolean

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

Name

Yes

String

Specifies a name for the variable.

Value

Yes

Object

Specifies a value for the variable.

The following code shows an example of the response body.

{
   "name":"Current Count",
   "properties":{
      "creationTime":"2015-05-21T18:03:40.837+00:00",
      "lastModifiedTime":"2015-05-21T18:03:40.837+00:00",
      "isEncrypted":false,
      "value":"41",
      "description":"Variable that keeps a current tally"
   }
}


201

For information about common error codes, see Service Management Status and Error Codes

Show: