1

I am creating and ARM template for Azure Automation and would like to upload custom modules. The example below I have seen it upload an public module giving the URL of the module . How do I modify this so that it takes my custom module.

"resources": [
                {
                    "name": "[concat(parameters('automationAccountName'), '/', variables('dscModules').xNetworking.ModuleName)]",
                    "type": "microsoft.automation/automationAccounts/Modules",
                    "apiVersion": "[variables('automationApiVersion')]",
                    "tags": {},
                    "dependsOn": [
                        "[concat('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'))]"
                    ],
                    "properties": {
                        "contentLink": {
                            "uri": "[variables('dscModules').xNetworking.ModuleUri]"
                        }
                    }
                }
Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
kumar
  • 8,207
  • 20
  • 85
  • 176

1 Answers1

0

Please refer to this blog:Deploy Custom Azure Automation Integration Modules Using ARM Templates. You could use the following template to deploy your custom modules to Azure automation account.

{
  "$schema": "http://schemas.microsoft.org/azure/deploymentTemplate?api-version=2015-01-01-preview#",
  "contentVersion": "1.0",
  "parameters": {
    "automationAccountType": {
      "type": "string",
      "allowedValues": [
        "New",
        "Existing"
      ]
    },
    "automationAccountName": {
      "type": "string"
    },
    "moduleName": {
      "type": "string"
    },
    "moduleUri":{
      "type": "string"  
    }
  },
  "variables": {
    "templatelink": "[concat('https://raw.githubusercontent.com/rchaganti/armseries/master/', parameters('automationAccountType'), 'AccountTemplate.json')]"
  },
  "resources": [
    {
      "apiVersion": "2015-01-01",
      "name": "nestedTemplate",
      "type": "Microsoft.Resources/deployments",
      "properties": {
        "mode": "incremental",
        "templateLink": {
          "uri": "[variables('templatelink')]",
          "contentVersion": "1.0"
        },
        "parameters": {
          "accountName": {
            "value": "[parameters('automationAccountName')]"
          },
          "accountLocation": {
            "value": "[resourceGroup().Location]"
          },
          "moduleName": {
            "value": "[parameters('moduleName')]"
          },
          "moduleUri": {
            "value": "[parameters('moduleUri')]"
          }
        }
      }
    }
  ]
}

The parameters should be below, just an example:

$parameters = @{
    'moduleName' = 'myModule'
    'moduleUri' = 'https://github.com/rchaganti/armseries/raw/master/MyModule.zip'
    'automationAccountName' = 'shuitest'
    'automationAccountType' = 'Existing'
    'TemplateFile' = 'D:\xuexi\automation.json'
}

Notes: You could get templatelink from this.

Also, you could refer to this answer.

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45