ksi*_*elo 7 azure azure-traffic-manager azure-rm-template
我正在尝试将端点添加到现有的 Azure 流量管理器。使用New-AzureRmResourceGroupDeployment
它部署下面的模板时,会删除以前的端点配置。
是否可以通过 ARM 模板将端点添加到现有流量管理器而不删除以前的模板?还是建议改用 Azure PowerShell 客户端?
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"trafficManagerName": {
"type": "String"
},
"webAppName": {
"type": "String"
},
"webAppLocationRegion": {
"type": "String"
},
"monitorPath": {
"type": "String"
}
},
"resources": [
{
"type": "Microsoft.Network/trafficManagerProfiles",
"name": "[parameters('trafficManagerName')]",
"apiVersion": "2017-05-01",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "[parameters('trafficManagerName')]",
"ttl": 70
},
"monitorConfig": {
"protocol": "HTTPS",
"port": 443,
"path": "[parameters('monitorPath')]"
},
"endpoints": [
{
"name": "[parameters('webAppName')]",
"type": "Microsoft.Network/trafficManagerProfiles/azureEndpoints",
"properties": {
"endpointStatus": "Enabled",
"targetResourceId": "[resourceId('Microsoft.Web/sites', parameters('webAppName'))]",
"weight": 1,
"priority": 1,
"endpointLocation": "[parameters('webAppLocationRegion')]"
}
}
]
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
打个比方,可以像这样向 Azure Key Vault 增量添加访问策略:
{
"type": "Microsoft.KeyVault/vaults/accessPolicies",
"name": "[concat(parameters('keyVaultSettings').name, '/add')]", <!-- notice the "/add" -->
"apiVersion": "2015-06-01",
"properties": {
"mode": "Incremental",
"accessPolicies": [
{
"tenantId": "[reference(concat(resourceId('Microsoft.Web/sites', parameters('webAppName')),'/providers/Microsoft.ManagedIdentity/Identities/default'), '2015-08-31-PREVIEW').tenantId]",
"objectId": "[reference(concat(resourceId('Microsoft.Web/sites', parameters('webAppName')),'/providers/Microsoft.ManagedIdentity/Identities/default'), '2015-08-31-PREVIEW').principalId]",
"permissions": {
"secrets": [
"get",
"list"
]
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
是的你可以。
诀窍是要了解流量管理器端点既是配置文件的属性,又是其本身的子资源。
因此,您的模板可以将端点部署为子资源。这不会影响其他端点或任何其他配置文件属性。
例如,查看模板库中的 Azure 流量管理器/Web 应用程序示例。流量管理器模板。
该示例使用 CopyIndex 循环以增量方式部署多个端点,每个 Web 应用程序一个。您可以简化此操作,删除循环,以逐步添加单个端点。
归档时间: |
|
查看次数: |
3026 次 |
最近记录: |