Create a variable
The Create a variable operation creates a new variable, or updates an existing variable by the same name.
Request
To specify the request, replace <subscription-id> with your subscription ID, <cloud-service-name> with the name of the cloud service to use for making the request, <automation-account-name> with the name of the automation account to use for making the request, and <variable-name> with a name for the variable. Include required URI parameters.
Method |
Request URI |
---|---|
PUT |
https://management.core.windows.net/<subscriptionId>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/variables/<variable-name>?api-version=2014-12-08} |
URI Parameters
Parameter |
Description |
---|---|
api-version |
Required. Must be set to 2014-12-08. |
Request Headers
The request headers in the following table are required.
Request Header |
Description |
---|---|
Content-Type |
Set to application/json. Do not include a specification for charset. |
x-ms-version |
Specifies the version of the operation. Set to 2013-06-01 or a later version. |
Request Body
This body is for creation of the "Bonus" variable.
You can create an encrypted variable by specifying true for isEncrypted in the request body. You cannot get the decrypted value using an API call as the value is only decrypted by runbooks and other objects in Microsoft Azure. You can set value with the digit 0 or 1 for false or true, or as a string with "false" or "true".
{
"properties":{
"description":"Variable that keeps a current tally",
"isEncrypted":0,
"type": "integer",
"value": 41
}
}
Element |
Required |
Type |
Description |
---|---|---|---|
description |
No |
String |
A description of the variable. |
isEncrypted |
No |
Boolean |
Indicator for whether this variable should be stored in an encrypted form. The default is "false". The value appears as masked characters in the portal. Encrypted values are not returned in GET operations. |
value |
Yes |
String |
The value the variable contains. |
Response
Status Code
A successful operation returns 201 (Created). For information about common error codes, see HTTP/1.1 Status Code Definitions.
Response Headers
Request Header |
Description |
---|---|
x-ms-request-id |
A unique identifier for the current operation. |
Response Body
This body shows the information for the "Bonus" variable.
{
"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"
}
}
Element |
Description |
---|---|
name |
A name for the variable. |
creationTime |
Date and time the variable was created. |
lastModificationTime |
The date and time the variable was last changed. |
isEncrypted |
Indicates whether the value is stored in an encrypted form. The default is "false". |
description |
A description of the variable. |
value |
The value the variable contains. Is not returned for encrypted variables. |