AutoPackWithAllResources.json

{
  "$schema": "http://schemas.microsoft.org/azure/deploymentTemplate?api-version=2015-01-01#",
  "contentVersion": "1.0",
  "parameters": {
    "accountName": {
      "type": "string",
      "metadata": {
        "description": "The name of the Automation account to use. This name should be taken from the Automation account the gallery. Will be displayed in the UX."
      }
    },
    "location": {
      "type": "string",
      "allowedValues": [
        "Japan East",
        "East US 2",
        "West Europe",
        "Southeast Asia",
        "South Central US"
      ],
      "metadata": {
        "description": "The region to deploy the Automation account in. Taken from the existing AA account. Will not be displayed in the UX in the MVP as user cannot change account."
      }
    },
    "pricingTier": {
      "type": "string",
      "allowedValues": [
        "Free",
        "Basic"
      ],
      "metadata": {
        "description": "The pricing tier for the account. Taken from the existing AA account. Will not be displayed in the UX in the MVP as user cannot change account."
      }
    },
    "scheduleName": {
      "type": "string",
      "metadata": {
        "description": "The name of the schedule. The user can change this since the runbook should never refer to it. ",
        "Resource": "schedules",
        "Name": "BethHourly",
        "PropertyType": "name"
      }
    },
    "frequency": {
      "type": "string",
      "allowedValues": [
        "onetime",
        "hour",
        "day"
      ],
      "metadata": {
        "description": "The frequency of the schedule.",
        "Resource": "schedules",
        "Name": "BethHourly",
        "PropertyType": "frequency"
      }
    },
    "jobScheduleGuid": {
      "type": "string",
      "metadata": {
        "description": "The GUID for the job schedule. This identifier links the schedule to the runbook.",
        "Resource": "jobSchedules",
        "Name": "BethHourly",
        "PropertyType": "guid"
      }
    },
    "scheduleInterval": {
      "type": "string",
      "metadata": {
        "description": "The schedule repeat frequency (e.g. schedule runs every [1] hours.)",
        "Resource": "schedules",
        "Name": "BethHourly",
        "PropertyType": "interval"
      }
    },
    "startTime": {
      "type": "string",
      "metadata": {
        "description": "The effective start date for the schedule.",
        "Resource": "schedules",
        "Name": "BethHourly",
        "PropertyType": "startTime"
      }
    },
    "userName": {
      "type": "string",
      "metadata": {
        "description": "The username for the Azure Automation credential.",
        "Resource": "credentials",
        "Name": "AdCredentialTemp",
        "PropertyType": "username"
      }
    },
    "password": {
      "type": "secureString",
      "metadata": {
        "description": "The password for the Azure Automation credential.",
        "Resource": "credentials",
        "Name": "AdCredentialTemp",
        "PropertyType": "password"
      }
    },
    "connectionCertificateName": {
      "type": "string",
      "metadata": {
        "description": "The name of the certificate used for Azure auth.",
        "Resource": "connections",
        "Name": "AzureConnection",
        "PropertyType": "AutomationCertificateName"
      }
    },
    "connectionSubscriptionId": {
      "type": "string",
      "metadata": {
        "description": "The ID of the Azure subscription you want to connect to.",
        "Resource": "connections",
        "Name": "AzureConnection",
        "PropertyType": "SubscriptionId"
      }
    },
    "variableValue": {
      "type": "string",
      "metadata": {
        "description": "The value for the variable. In this case, a string value.",
        "Resource": "variables",
        "Name": "BethTestVar",
        "PropertyType": "value",
        "VariableType": "string"
      }
    },
    "base64Value": {
      "type": "securestring",
      "metadata": {
        "description": "The base 64 value for the certificate.",
        "Resource": "certificates",
        "Name": "BethCert",
        "PropertyType": "base64Value"
      }
    },
    "thumbprint": {
      "type": "securestring",
      "metadata": {
        "description": "The thumprint value for the certificate.",
        "Resource": "certificates",
        "Name": "BethCert",
        "PropertyType": "thumbprint"
      }
    }
 
  },
  "variables": {
    "runbookGraphName": "StartAzureRMVM",
    "runbookGraphURI": "https://gallery.technet.microsoft.com/scriptcenter/Start-Azure-ARM-VMs-66fb875d/file/149167/1/StartAzureRMVM.graphrunbook",
    "moduleName": "AzureRm.Profile",
    "moduleUri": "https://devopsgallerystorage.blob.core.windows.net/packages/azurerm.profile.1.0.6.nupkg",
    "credentialName": "AdCredentialTemp",
    "connectionName": "AzureConnection",
    "variableName": "BethTestVar",
    "certificateName": "BethCert",
    "configurationURI": "https://raw.githubusercontent.com/azureautomation/automation-packs/7c2a7c901099b384a05e17261d3c6b4192e841b4/201-Deploy-And-Compile-DSC-Configuration-using-base-templates/Configurations/webrolefull.ps1",
    "configurationName": "webrolefull",
    "dscOverwrite": "true"
  },
 
  "resources": [
    {
      "name": "[parameters('accountName')]",
      "type": "Microsoft.Automation/automationAccounts",
      "apiVersion": "2015-01-01-preview",
      "location": "[parameters('location')]",
      "dependsOn": [
      ],
      "tags": {
      },
      "properties": {
        "comment": "Resource defined structure",
        "sku": {
          "name": "[parameters('pricingTier')]"
        }
      },
      "resources": [
        {
          "name": "[variables('runbookGraphName')]",
          "type": "runbooks",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": {
            "AutomationPack": "sampleAll"
          },
          "properties": {
            "runbookType": "Graph",
            "logProgress": "false",
            "logVerbose": "false",
            "description": "This is a graphical runbook",
            "publishContentLink": {
              "uri": "[variables('runbookGraphURI')]",
              "version": "1.0.0.0"
            }
          }
        },
        {
          "name": "[parameters('scheduleName')]",
          "type": "schedules",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": {
          },
          "properties": {
            "description": "My schedule description",
            "startTime": "[parameters('startTime')]",
            "isEnabled": "true",
            "interval": "[parameters('scheduleInterval')]",
            "frequency": "[parameters('frequency')]"
          }
        },
 
        {
          "name": "[parameters('jobScheduleGuid')]",
          "type": "jobSchedules",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]",
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'), '/runbooks/', variables('runbookGraphName'))]",
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'), '/schedules/', parameters('scheduleName'))]"
          ],
          "tags": {
          },
          "properties": {
            "schedule": {
              "name": "[parameters('scheduleName')]"
            },
            "runbook": {
              "name": "[ variables('runbookGraphName')]"
            }
          }
        },
        {
          "name": "[variables('moduleName')]",
          "type": "modules",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": {
          },
          "properties": {
            "contentLink": {
              "uri": "[variables('moduleUri')]"
            }
          }
        },
        {
          "name": "[variables('credentialName')]",
          "type": "credentials",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": { },
          "properties": {
            "userName": "[parameters('userName')]",
            "password": "[parameters('password')]"
          }
        },
        {
          "name": "[variables('connectionName')]",
          "type": "connections",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": {
          },
          "properties": {
            "name": "[variables('connectionName')]",
            "description": "Dummy Azure connection",
            "isGlobal": false,
            "connectionType": {
              "name": "Azure"
            },
            "fieldDefinitionValues": {
              "AutomationCertificateName": "[parameters('connectionCertificateName')]",
              "SubscriptionID": "[parameters('connectionSubscriptionId')]"
            }
          }
 
        },
        {
          "name": "[variables('variableName')]",
          "type": "variables",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": {
          },
          "properties": {
            "description": "Some description",
            "isEncrypted": 0,
            "type": "string",
            "value": "[concat('\"', parameters('variableValue'),'\"')]"
          }
        },
        {
          "name": "[variables('certificateName')]",
          "type": "certificates",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "tags": {
          },
          "properties": {
            "base64Value": "[parameters('base64Value')]",
            "thumbprint": "[parameters('thumbprint')]"
          }
        },
        {
          "name": "[variables('configurationName')]",
          "type": "Configurations",
          "apiVersion": "2015-01-01-preview",
          "location": "[parameters('location')]",
          "tags": { "AutomationPack": "sampleAll" },
          "dependsOn": [
            "[concat('Microsoft.Automation/automationAccounts/', parameters('accountName'))]"
          ],
          "properties": {
            "logVerbose": "false",
            "description": "my description",
            "state": "Published",
            "overwrite": "[variables('dscOverwrite')]",
            "Source": {
              "type": "uri",
              "Value": "[variables('configurationURI')]"
            }
          }
        }
 
 
      ]
    }
  ],
 
  "outputs": {
  }
}