2

I'm trying to build a custom ARM template that deploys a new resource group (web,sql,redis,storage) that also creates a custom CNAME record in our dnsZone hosted in a different/existing resGroup. Finally, I'd like to add a certificate binding (wildcard) from our KeyVault also stored in the other resGroup.

It seems there is support for adding a zone in the new resGroup, but can't find example of leveraging existing zone and just adding a CNAME record that points to my new web app.

It also seems there are examples of creating Key Vaults, but not binding a site up to an existing cert in an existing vault in a different resGroup.

This is a very common multi-tenant kind of scenario, sure seems it should be possible in our template, without having to rely on PowerShell or Azure CLI.

2
  • Dns is hosted in azure dnszone. Commented Dec 6, 2017 at 21:24
  • Yes - I'm trying to use this: learn.microsoft.com/en-us/azure/templates/microsoft.network/… but not having any luck, as it seems to expect the dnsZone is in the same resource group (or else the properties just documented well enough for me to follow). Commented Dec 6, 2017 at 21:48

1 Answer 1

2

Just wrap your dnsZone resource with a deployment resource and scope it to another group.

{
    "apiVersion": "2017-05-10",
    "name": "nestedTemplate",
    "type": "Microsoft.Resources/deployments",
    "resourceGroup": %%% resource group name goes here %%%,
    "properties": {
        "mode": "Incremental",
        "template": {
            "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
            "contentVersion": "1.0.0.0",
            "parameters": {},
            "variables": {},
            "resources": [
                %%%% dnsZone goes here %%%
            ]
        },
        "parameters": {}
    }
}

For the KV, you can use the example from the quickstarts:
https://github.com/Azure/azure-quickstart-templates/blob/master/webapp-keyvault-ssl/azuredeploy.json

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks - this was exactly what I needed. Much appreciated. Didn't realize you could add a second resource group that way. A hidden gem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.