如何在ARM模板中动态生成Traffic Manager端点? [英] How do I dynamically generate Traffic Manager endpoints in an ARM template?

查看:62
本文介绍了如何在ARM模板中动态生成Traffic Manager端点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ARM模板,该模板使用copy构造创建任意数量的Azure webapp,就像这样(删除了不相关的部分):

I have an ARM template that creates an arbitrary number of Azure webapps using the copy construct, like so (non-relevant portions removed):

{
  "parameters": { 
    "numWebsites": {
      "type": "int",
      "defaultValue": 2
    }
  },
  "resources": [
    "name": "[concat('webapp-', copyIndex()]",
    "type": "Microsoft.Web/sites",
    "copy": {
      "name": "websitescopy",
      "count": "[parameters('numWebsites')]"
    }
  ]
}

我还要创建一个流量管理器配置文件,并为每个创建的网站提供一个端点.但是,似乎没有办法在流量管理器资源的endpoints参数中使用copy.我见过的所有示例都有端点

I'd also like to create a Traffic Manager profile with an endpoint for each of the websites created. However, there doesn't seem to be a way to make use of copy in the Traffic Manager resource's endpoints parameter. All of the examples I've seen have the endpoints explicitly listed out, but I don't know how many webapps are being created ahead of time so that doesn't work for me.

如何在模板中动态生成端点?我曾尝试在trafficManagerProfiles资源中使用copy语句,但这会创建多个配置文件,每个配置文件都具有一个端点.

How can I generate the endpoints in my template dynamically? I've tried using a copy statement in the trafficManagerProfiles resource, but that creates multiple profiles with a single endpoint each.

推荐答案

下面是一个将外部端点创建为子资源"的示例,该概要文件是在没有任何端点的情况下单独创建的,然后此资源添加了该端点.它使用一个外部端点,但是对于Web应用程序应该也可以正常工作,并且与标准复制功能兼容.

Here's an example of creating an external endpoint as a "child resource", the profile is created separately without any endpoints and then this resource adds the endpoint. It uses an external endpoint but should work just as well for a webapp and is compatible with the standard copy function.

HtH, 加雷斯

    {
        "apiVersion": "2015-11-01",
        "type": "Microsoft.Network/trafficManagerProfiles/ExternalEndpoints",
        "name": "ExternalEndpointExample/endpoint1",
        "dependsOn": ["Microsoft.Network/trafficManagerProfiles/ExternalEndpointExample"],
        "location": "global",
        "properties": {
            "target": "ep1.microsoft.com",
            "endpointStatus": "Enabled",
            "endpointLocation": "northeurope"
        }
    }

这篇关于如何在ARM模板中动态生成Traffic Manager端点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆