You are on page 1of 5

{

"$schema":
"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string",
"defaultValue": "[resourceGroup().name]"
},
"newAppServicePlanName": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "The name of the new App Service Plan."
}
},
"newAppServicePlanSku": {
"type": "object",
"defaultValue": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
},
"metadata": {
"description": "The SKU of the App Service Plan. Defaults to Standard
values."
}
},
"appServicePlanLocation": {
"type": "string",
"metadata": {
"description": "The location of the App Service Plan."
}
},
"existingAppServicePlan": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Name of the existing App Service Plan used to create the
Web App for the bot."
}
},
"appInsightsName": {
"type": "string",
"defaultValue": "[resourceGroup().name]"
},
"appInsightsLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"qnaMakerServiceName": {
"type": "string",
"defaultValue": "[concat(parameters('name'), '-qna')]"
},
"qnaMakerServiceSku": {
"type": "string",
"defaultValue": "S0"
},
"qnaMakerServiceLocation": {
"type": "string",
"defaultValue": "westus"
},
"qnaMakerSearchName": {
"type": "string",
"defaultValue": "[concat(parameters('name'), '-search')]"
},
"qnaMakerSearchSku": {
"type": "string",
"defaultValue": "standard"
},
"qnaMakerSearchLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"qnaMakerWebAppName": {
"type": "string",
"defaultValue": "[concat(parameters('name'), '-qnahost')]"
},
"qnaMakerWebAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"variables": {
"defaultAppServicePlanName":
"[if(empty(parameters('existingAppServicePlan')), 'createNewAppServicePlan',
parameters('existingAppServicePlan'))]",
"useExistingAppServicePlan":
"[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]",
"servicePlanName": "[if(variables('useExistingAppServicePlan'),
parameters('existingAppServicePlan'), parameters('newAppServicePlanName'))]",
"resourcesLocation": "[parameters('appServicePlanLocation')]",
"qnaMakerSearchName": "[toLower(replace(parameters('qnaMakerSearchName'),
'_', ''))]",
"qnaMakerWebAppName": "[replace(parameters('qnaMakerWebAppName'), '_', '')]"
},
"resources": [
{
"apiVersion": "2018-02-01",
"name": "1d41002f-62a1-49f3-bd43-2f3f32a19cbb",
"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": []
}
}
},
{
"comments": "Create a new App Service Plan if no existing App Service Plan
name was passed in.",
"type": "Microsoft.Web/serverfarms",
"condition": "[not(variables('useExistingAppServicePlan'))]",
"name": "[variables('servicePlanName')]",
"apiVersion": "2018-02-01",
"location": "[variables('resourcesLocation')]",
"sku": "[parameters('newAppServicePlanSku')]",
"properties": {
"name": "[variables('servicePlanName')]"
}
},
{
"comments": "app insights",
"type": "Microsoft.Insights/components",
"kind": "web",
"apiVersion": "2015-05-01",
"name": "[parameters('appInsightsName')]",
"location": "[parameters('appInsightsLocation')]",
"properties": {
"Application_Type": "web"
}
},
{
"comments": "Cognitive service key for all QnA Maker knowledgebases.",
"type": "Microsoft.CognitiveServices/accounts",
"kind": "QnAMaker",
"apiVersion": "2017-04-18",
"name": "[parameters('qnaMakerServiceName')]",
"location": "[parameters('qnaMakerServiceLocation')]",
"sku": {
"name": "[parameters('qnaMakerServiceSku')]"
},
"properties": {
"apiProperties": {
"qnaRuntimeEndpoint":
"[concat('https://',reference(resourceId('Microsoft.Web/sites',
variables('qnaMakerWebAppName'))).hostNames[0])]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('qnaMakerWebAppName'))]",
"[resourceId('Microsoft.Search/searchServices/',
variables('qnaMakerSearchName'))]",
"[resourceId('microsoft.insights/components/',
parameters('appInsightsName'))]"
]
},
{
"comments": "Search service for QnA Maker service.",
"type": "Microsoft.Search/searchServices",
"apiVersion": "2015-08-19",
"name": "[variables('qnaMakerSearchName')]",
"location": "[parameters('qnaMakerSearchLocation')]",
"sku": {
"name": "[parameters('qnaMakerSearchSku')]"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"hostingMode": "default"
}
},
{
"comments": "Web app for QnA Maker service.",
"type": "Microsoft.Web/sites",
"apiVersion": "2016-08-01",
"name": "[variables('qnaMakerWebAppName')]",
"location": "[parameters('qnaMakerWebAppLocation')]",
"properties": {
"enabled": true,
"name": "[variables('qnaMakerWebAppName')]",
"hostingEnvironment": "",
"serverFarmId": "[concat('/subscriptions/',
Subscription().SubscriptionId,'/resourcegroups/', resourceGroup().name,
'/providers/Microsoft.Web/serverfarms/', variables('servicePlanName'))]",
"siteConfig": {
"cors": {
"allowedOrigins": [
"*"
]
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms/',
variables('servicePlanName'))]"
],
"resources": [
{
"apiVersion": "2016-08-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites',
variables('qnaMakerWebAppName'))]",
"[resourceId('Microsoft.Insights/components',
parameters('appInsightsName'))]",
"[resourceId('Microsoft.Search/searchServices/',
variables('qnaMakerSearchName'))]"
],
"properties": {
"AzureSearchName": "[variables('qnaMakerSearchName')]",
"AzureSearchAdminKey":
"[listAdminKeys(resourceId('Microsoft.Search/searchServices/',
variables('qnaMakerSearchName')), '2015-08-19').primaryKey]",
"UserAppInsightsKey":
"[reference(resourceId('Microsoft.Insights/components/',
parameters('appInsightsName')), '2015-05-01').InstrumentationKey]",
"UserAppInsightsName": "[parameters('appInsightsName')]",
"UserAppInsightsAppId":
"[reference(resourceId('Microsoft.Insights/components/',
parameters('appInsightsName')), '2015-05-01').AppId]",
"PrimaryEndpointKey": "[concat(variables('qnaMakerWebAppName'), '-
PrimaryEndpointKey')]",
"SecondaryEndpointKey": "[concat(variables('qnaMakerWebAppName'), '-
SecondaryEndpointKey')]",
"DefaultAnswer": "No good match found in KB.",
"QNAMAKER_EXTENSION_VERSION": "latest"
}
}
]
}
],
"outputs": {
"qna": {
"type": "object",
"value": {
"endpoint": "[concat('https://',
reference(resourceId('Microsoft.Web/sites',
variables('qnaMakerWebAppName'))).hostNames[0])]",
"subscriptionKey":
"[listKeys(resourceId('Microsoft.CognitiveServices/accounts',
parameters('qnaMakerServiceName')),'2017-04-18').key1]"
}
}
}
}

You might also like