Gregory Suvalian
Gregory Suvalian

Reputation: 3832

How do I reference external objects for my template

My ARM template needs to create DSC node configuration in Azure Automation Account which is not part of template and exists in external resource group. How do I properly reference automation account for Microsoft.Automation/automationAccounts/configurations template?

https://learn.microsoft.com/en-us/azure/templates/microsoft.automation/automationaccounts/configurations

Example of what I have is below

 {
  "name": "[reference(resourceId(parameters('AutomationaccountRGName'), 'Microsoft.Automation/automationAccounts/configurations', parameters('AutomationaccountName'), 'swarmhost.localhost'))]",
  "type": "Microsoft.Automation/automationAccounts/configurations",
  "apiVersion": "[variables('automationApiVersion')]",
  "properties": {
    "logVerbose": "false",
    "description": "Configuration for worker hosts",
    "Source": {
      "type": "uri",
      "Value": "https://raw.githubusercontent.com/artisticcheese/SwarmARM/master/VMSS-Linked/swarmhost.ps1"
    }
  }
}

Upvotes: 1

Views: 1178

Answers (1)

4c74356b41
4c74356b41

Reputation: 72191

Use a reference function for that:

reference(resourceId('resourcegroupName', 'Microsoft.Automation/automationAccounts/configurations', 'automationAccountName', 'configurationName'), 'api-version')

reference: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#reference

Upvotes: 1

Related Questions