【问题标题】:Azure ARM Template to deploy website with cname and certificate使用 cname 和证书部署网站的 Azure ARM 模板
【发布时间】:2017-12-06 20:20:45
【问题描述】:

我正在尝试构建一个自定义 ARM 模板,该模板部署一个新资源组(web、sql、redis、storage),该模板还在我们托管在不同/现有 resGroup 中的 dnsZone 中创建自定义 CNAME 记录。最后,我想从我们的 KeyVault 添加一个证书绑定(通配符),也存储在另一个 resGroup 中。

似乎支持在新 resGroup 中添加区域,但找不到利用现有区域并仅添加指向我的新 Web 应用程序的 CNAME 记录的示例。

似乎也有创建 Key Vault 的示例,但没有将站点绑定到不同 resGroup 中现有 Vault 中的现有证书。

这是一种非常常见的多租户场景,在我们的模板中似乎应该可以实现,而无需依赖 PowerShell 或 Azure CLI。

【问题讨论】:

标签: azure azure-resource-manager azure-deployment azure-template


【解决方案1】:

只需使用部署资源包装您的 dnsZone 资源并将其范围限定到另一个组。

{
    "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": {}
    }
}

对于 KV,您可以使用快速入门中的示例:
https://github.com/Azure/azure-quickstart-templates/blob/master/webapp-keyvault-ssl/azuredeploy.json

【讨论】:

  • 谢谢 - 这正是我所需要的。非常感激。没有意识到您可以通过这种方式添加第二个资源组。一颗隐藏的宝石!
猜你喜欢
  • 2019-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-23
相关资源
最近更新 更多