1

私は(非関連部分を削除)のようなので、copy構文を使用してアズールWebアプリケーションの任意の数を作成し、ARMのテンプレートがあります。ARMテンプレートでTraffic Managerエンドポイントを動的に生成するにはどうすればよいですか?

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

私もしてトラフィックマネージャのプロファイルを作成したいのですが作成された各Webサイトのエンドポイント。ただし、Traffic Managerリソースのendpointsパラメータにcopyを使用する方法はありません。私が見たすべての例では、エンドポイントはexplicitly listed outですが、事前に作成されているWebアプリケーションの数がわからないので、うまく動作しません。

テンプレートでエンドポイントを動的に生成するにはどうすればよいですか?私はcopyステートメントをtrafficManagerProfilesリソースで使用しようとしましたが、それはそれぞれ1つのエンドポイントを持つ複数のプロファイルを作成します。

答えて

1

ここでは、外部エンドポイントを「子リソース」として作成する例を示します。プロファイルはエンドポイントなしで個別に作成され、このリソースによってエンドポイントが追加されます。外部エンドポイントを使用しますが、Webアプリケーションの場合と同様に動作し、標準のコピー機能と互換性があります。

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" 
     } 
    } 
1

私はまだこれをテストしていませんが、それはコピー/ copyIndexは今トラフィックマネージャのエンドポイントでサポートされているシナリオでなければなりません表示されます。ここでは

https://feedback.azure.com/forums/217313-networking/suggestions/12907815-support-copy-copyindex-in-traffic-manager-depend

私はしばらく前に実装したサンプルです:

{ 
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
    "contentVersion": "1.0.0.0", 
    "parameters": { 
    "solution-abbreviation": { 
     "type": "string", 
     "minLength": 1 
    }, 
    "environment-abbreviation": { 
     "type": "string", 
     "allowedValues": [ 
     "dev", 
     "test", 
     "prod" 
     ] 
    }, 

    "userinterface-abbreviation": { 
     "type": "string", 
     "minLength": 1 
    }, 
    "userinterface-locations": { 
     "type": "array", 
     "minLength": 1 
    }, 
    "userinterface-appserviceplan-sku": { 
     "type": "string", 
     "allowedValues": [ 
     "Free", 
     "Shared", 
     "Basic", 
     "Standard" 
     ] 
    }, 
    "userinterface-appserviceplan-workersize": { 
     "type": "string", 
     "allowedValues": [ 
     "0", 
     "1", 
     "2" 
     ] 
    }, 
    "userinterface-appserviceplan-numberofworkers": { 
     "type": "int" 
    } 
    }, 
    "variables": { 
    "userinterface-trafficmanager-name": "[concat(parameters('solution-abbreviation'), '-', parameters('environment-abbreviation'), '-', parameters('userinterface-abbreviation'))]" 
    }, 
    "resources": [ 
    { 
     "name": "[concat(variables('userinterface-trafficmanager-name'), '-', parameters('userinterface-locations')[copyIndex()])]", 
     "type": "Microsoft.Web/serverfarms", 
     "location": "[parameters('userinterface-locations')[copyIndex()]]", 
     "apiVersion": "2014-06-01", 
     "dependsOn": [ ], 
     "tags": { 
     "displayName": "[concat(variables('userinterface-trafficmanager-name'), '-', parameters('userinterface-locations')[copyIndex()])]" 
     }, 
     "copy": { 
     "name": "[concat('serverfarms', '-copy')]", 
     "count": "[length(parameters('userinterface-locations'))]" 
     }, 
     "properties": { 
     "name": "[concat(variables('userinterface-trafficmanager-name'), '-', parameters('userinterface-locations')[copyIndex()])]", 
     "sku": "[parameters('userinterface-appserviceplan-sku')]", 
     "workerSize": "[parameters('userinterface-appserviceplan-workersize')]", 
     "numberOfWorkers": "[parameters('userinterface-appserviceplan-numberofworkers')]" 
     } 
    } 
    ], 
    "outputs": { 
    } 
} 
+0

このリンクには、これらのエンドポイントを作成する方法の例はまだありません。これがどのように機能するかの例がありますか? –

+0

私は例を持っています...私はすぐに適切なスニペットを含めるために私の答えを編集しようとします。 – Paul

関連する問題