Create a module
The Create a module operation creates a new module with the supplied data. The module name must be unique with an automation account.
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 <module-name> with a name for the module. Include required URI parameters.
Method |
Request URI |
---|---|
PUT |
https://management.core.windows.net/<subscription-id>/cloudServices/<cloud-service-name>/resources/automation/~/automationAccounts/<automation-account-name>/modules/<module-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
{
"tags":{
"Testing":"Modules"
},
"properties":{
"contentLink":{
"uri":"https://litwarestorage.blob.core.test-cint.azure-test.net/litware-modules/ModuleA.zip",
"version":"1.0.0.0",
"contentHash":{
"algorithm":"sha256",
"value":"lHFQ8pRubCJIUbyxQc0g6947jO/UflLJiz25ZTrS8gM="
}
}
}
}
Element |
Required |
Type |
Description |
---|---|---|---|
tags |
No |
String |
A list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 10 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. |
contentLink/uri |
Yes |
String |
Specifies the public location of an existing .psm1 file containing a single PowerShell module, to be added to Azure Automation. This location can be any public URL. If using Azure Storage, make sure the blob is public, or use a SAS link to the Azure Storage blob. |
contentLink/contentVersion |
No |
String |
Specifies a value for versioning purposes. |
contentLink/contentHash |
No |
String |
Specifies the value of the hash of the content at the content link, and the algorithm for obtaining a content hash value, as a Base64-encoded string. This can be used to prevent import of the runbook if the content at the content link location is modified after the hash value to use was generated.You can use the following script to obtain this value:
|
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
{
"id":"\/subscriptions\/2310a662-9154-4254-a8e1-34286f3bf56a\/cloudservices\/CLSV2_Litware\/resources\/~\/AutomationAccounts\/LitwareDataCenter\/modules\/ModuleA",
"name":"ModuleA",
"type":"Microsoft.Automation\/AutomationAccount\/Module",
"location":"East US 2",
"tags":{
"Testing":"Modules"
},
"etag":null,
"properties":{
"isGlobal":false,
"version":0,
"sizeInBytes":0,
"activityCount":0,
"creationTime":"0001-01-01T00:00:00+00:00",
"lastModifiedTime":"0001-01-01T00:00:00+00:00",
"error":{
"code":null,
"message":null
},
"provisioningState":"Creating"
}
}
Element |
Description |
---|---|
id |
The URI for this entity, excluding hostname/schema and api version. Not URL encoded. This field is used by the platform as the identifier for references for other objects. |
name |
The name of the module. |
type |
The type of the resource (e.g., Microsoft.Automation/AutomationAccount/Module) |
location |
The location of the resource. The resource must be built in this geographical region. |
tags |
Any key value pairs that were provided for business purposes. |
etag |
Value used for concurrence control. |
properties/isGlobal |
Flag indicating whether the module is global. |
properties/version |
The version of the module. |
properties/sizeInBytes |
The size of the module in bytes. |
properties/activityCount |
The number of activities contained within the module. |
properties/creationTime |
The date and time the module was created. |
properties/lastModifiedTime |
The date and time the module was last changed. |
properties/error |
An array of any error codes and their messages. |
properties/provisioningState |
The state of the job until a terminal state is reached. |