Updated ARM template. Added ARM template to configure TLS/SSL cert for app services

This commit is contained in:
Ganesh Radhakrishnan 2020-04-01 16:45:31 -07:00
Родитель ccc07c5d06
Коммит 80e5a1355f
3 изменённых файлов: 248 добавлений и 9 удалений

Просмотреть файл

@ -1,6 +1,10 @@
{ {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json", "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0", "contentVersion": "1.0.0.0",
"metadata" : {
"comments": "This ARM template deploys Azure resources included in the Health Bot Reference Architecture",
"author": "Microsoft Healthcare CSU"
},
"parameters": { "parameters": {
"name": { "name": {
"type": "string", "type": "string",
@ -14,8 +18,10 @@
"westus", "westus",
"eastus" "eastus"
], ],
"minLength": 2,
"maxLength": 2,
"metadata":{ "metadata":{
"description":"Array of Azure deployment regions to deploy to." "description":"Array of Azure regions to deploy resources to."
} }
}, },
"APP_SECRET": { "APP_SECRET": {
@ -184,9 +190,21 @@
{ {
"name": "WEBSITE_NODE_DEFAULT_VERSION", "name": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "6.9.1" "value": "6.9.1"
},
{
"name": "UserAppInsightsKey",
"value": "[reference(resourceId('Microsoft.Insights/components/', concat(variables('appInsightsName'), copyIndex())), '2015-05-01').InstrumentationKey]"
},
{
"name": "UserAppInsightsName",
"value": "[concat(variables('appInsightsName'), copyIndex())]"
},
{ "name": "UserAppInsightsAppId",
"value": "[reference(resourceId('Microsoft.Insights/components/', concat(variables('appInsightsName'), copyIndex())), '2015-05-01').AppId]"
} }
] ]
} },
"httpsOnly": "true"
}, },
"resources": [ "resources": [
{ {
@ -269,7 +287,8 @@
"*" "*"
] ]
} }
} },
"httpsOnly": "true"
}, },
"dependsOn": [ "dependsOn": [
"[concat('Microsoft.Web/serverfarms/', concat(variables('appServicePlanName'), copyIndex()))]" "[concat('Microsoft.Web/serverfarms/', concat(variables('appServicePlanName'), copyIndex()))]"
@ -309,14 +328,14 @@
"location": "global", "location": "global",
"properties": { "properties": {
"profileStatus": "Enabled", "profileStatus": "Enabled",
"trafficRoutingMethod": "Priority", "trafficRoutingMethod": "Performance",
"dnsConfig": { "dnsConfig": {
"relativeName": "[variables('trafficManagerDnsName')]", "relativeName": "[variables('trafficManagerDnsName')]",
"ttl": 30 "ttl": 30
}, },
"monitorConfig": { "monitorConfig": {
"protocol": "HTTP", "protocol": "HTTPS",
"port": 80, "port": 443,
"path": "/" "path": "/"
} }
} }
@ -336,6 +355,7 @@
}, },
"properties": { "properties": {
"targetResourceId": "[resourceId('Microsoft.Web/sites/', concat(variables('webAppClientName'), copyIndex()))]", "targetResourceId": "[resourceId('Microsoft.Web/sites/', concat(variables('webAppClientName'), copyIndex()))]",
"endpointLocation": "[parameters('locations')[copyIndex()]]",
"endpointStatus": "Enabled" "endpointStatus": "Enabled"
} }
}, },
@ -346,14 +366,14 @@
"location": "global", "location": "global",
"properties": { "properties": {
"profileStatus": "Enabled", "profileStatus": "Enabled",
"trafficRoutingMethod": "Priority", "trafficRoutingMethod": "Weighted",
"dnsConfig": { "dnsConfig": {
"relativeName": "[variables('qnaTrafficManagerDnsName')]", "relativeName": "[variables('qnaTrafficManagerDnsName')]",
"ttl": 30 "ttl": 30
}, },
"monitorConfig": { "monitorConfig": {
"protocol": "HTTP", "protocol": "HTTPS",
"port": 80, "port": 443,
"path": "/" "path": "/"
} }
} }
@ -373,6 +393,7 @@
}, },
"properties": { "properties": {
"targetResourceId": "[resourceId('Microsoft.Web/sites/', concat(variables('qnaMakerWebAppName'), copyIndex()))]", "targetResourceId": "[resourceId('Microsoft.Web/sites/', concat(variables('qnaMakerWebAppName'), copyIndex()))]",
"weight": 1,
"endpointStatus": "Enabled" "endpointStatus": "Enabled"
} }
}, },

206
cert-deploy.json Normal file
Просмотреть файл

@ -0,0 +1,206 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"metadata" : {
"comments": "This ARM template deploys Azure resources included in the Health Bot Reference Architecture",
"author": "Microsoft Healthcare CSU"
},
"parameters": {
"name": {
"type": "string",
"metadata":{
"description":"Base name (prefix) for all resources."
}
},
"locations": {
"type": "array",
"defaultValue": [
"westus",
"eastus"
],
"metadata":{
"description":"Array of Azure deployment regions to deploy to."
}
},
"tmDomainSuffix": {
"type": "string",
"defaultValue": ".trafficmanager.net",
"metadata":{
"description":"Azure Traffic Manager DNS suffix"
}
}
},
"variables": {
"appServicePlanName": "[concat(parameters('name'), '-appServicePlan')]",
"webAppClientName": "[concat(parameters('name'), '-webClient')]",
"customDomainWebAppSvc": "[concat(parameters('name'), '-webclient', parameters('tmDomainSuffix'))]",
"qnaMakerWebAppName": "[replace(concat(parameters('name'), '-qnahost'), '_', '')]",
"customDomainQnaAppSvc": "[concat(parameters('name'), '-qna', parameters('tmDomainSuffix'))]"
},
"resources": [
{
"type": "Microsoft.Web/sites/hostnameBindings",
"apiVersion": "2019-08-01",
"name": "[concat(variables('webAppClientName'), copyIndex(), '/', variables('customDomainWebAppSvc'))]",
"location": "[parameters('locations')[copyIndex()]]",
"properties": {
},
"copy": {
"name": "locationLoop",
"count": "[length(parameters('locations'))]"
}
},
{
"type": "Microsoft.Web/certificates",
"apiVersion": "2019-08-01",
"name": "[concat(variables('webAppClientName'), copyIndex())]",
"location": "[parameters('locations')[copyIndex()]]",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', concat(variables('appServicePlanName'), copyIndex()))]",
"canonicalName": "[variables('customDomainWebAppSvc')]"
},
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(variables('webAppClientName'), copyIndex(), '/hostnameBindings/', variables('customDomainWebAppSvc')))]"
],
"copy": {
"name": "locationLoop",
"count": "[length(parameters('locations'))]"
}
},
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites/hostnameBindings",
"name": "[concat(variables('webAppClientName'),'0','/',variables('customDomainWebAppSvc'))]",
"apiVersion": "2019-08-01",
"location": "[parameters('locations')[0]]",
"properties": {
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', concat(variables('webAppClientName'), '0'))).Thumbprint]"
}
}
],
"outputs": {
}
}
}
},
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate0",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites/hostnameBindings",
"name": "[concat(variables('webAppClientName'),'1','/',variables('customDomainWebAppSvc'))]",
"apiVersion": "2019-08-01",
"location": "[parameters('locations')[1]]",
"properties": {
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', concat(variables('webAppClientName'), '1'))).Thumbprint]"
}
}
],
"outputs": {
}
}
}
},
{
"type": "Microsoft.Web/sites/hostnameBindings",
"apiVersion": "2019-08-01",
"name": "[concat(variables('qnaMakerWebAppName'), copyIndex(), '/', variables('customDomainQnaAppSvc'))]",
"location": "[parameters('locations')[copyIndex()]]",
"properties": {
},
"copy": {
"name": "locationLoop",
"count": "[length(parameters('locations'))]"
}
},
{
"type": "Microsoft.Web/certificates",
"apiVersion": "2019-08-01",
"name": "[concat(variables('qnaMakerWebAppName'), copyIndex())]",
"location": "[parameters('locations')[copyIndex()]]",
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', concat(variables('appServicePlanName'), copyIndex()))]",
"canonicalName": "[variables('customDomainQnaAppSvc')]"
},
"dependsOn": [
"[concat('Microsoft.Web/sites/', concat(variables('qnaMakerWebAppName'), copyIndex(), '/hostnameBindings/', variables('customDomainQnaAppSvc')))]"
],
"copy": {
"name": "locationLoop",
"count": "[length(parameters('locations'))]"
}
},
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate1",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites/hostnameBindings",
"name": "[concat(variables('qnaMakerWebAppName'),'0','/',variables('customDomainQnaAppSvc'))]",
"apiVersion": "2019-08-01",
"location": "[parameters('locations')[0]]",
"properties": {
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', concat(variables('qnaMakerWebAppName'), '0'))).Thumbprint]"
}
}
],
"outputs": {
}
}
}
},
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate2",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/sites/hostnameBindings",
"name": "[concat(variables('qnaMakerWebAppName'),'1','/',variables('customDomainQnaAppSvc'))]",
"apiVersion": "2019-08-01",
"location": "[parameters('locations')[1]]",
"properties": {
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', concat(variables('qnaMakerWebAppName'), '1'))).Thumbprint]"
}
}
],
"outputs": {
}
}
}
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,12 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "grtst04"
},
"locations": {
"value": ["westus","westus2"]
}
}
}