189 lines
6.6 KiB
JSON
189 lines
6.6 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"appServiceName": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"description": "The globally unique name of the Web App."
|
|
}
|
|
},
|
|
"existingAppServicePlanName": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"description": "Name of the existing App Service Plan used to create the Web App for the bot."
|
|
}
|
|
},
|
|
"existingAppServicePlanLocation": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The location of the App Service Plan."
|
|
}
|
|
},
|
|
"newAppServicePlanName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The name of the new App Service Plan."
|
|
}
|
|
},
|
|
"newAppServicePlanLocation": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The location of the 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."
|
|
}
|
|
},
|
|
"appType": {
|
|
"type": "string",
|
|
"defaultValue": "MultiTenant",
|
|
"allowedValues": [
|
|
"MultiTenant",
|
|
"SingleTenant",
|
|
"UserAssignedMSI"
|
|
],
|
|
"metadata": {
|
|
"description": "Type of Bot Authentication. set as MicrosoftAppType in the Web App's Application Settings. Allowed values are: MultiTenant, SingleTenant, UserAssignedMSI. Defaults to \"MultiTenant\"."
|
|
}
|
|
},
|
|
"appId": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings."
|
|
}
|
|
},
|
|
"appSecret": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types. Defaults to \"\"."
|
|
}
|
|
},
|
|
"UMSIName": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"description": "The User-Assigned Managed Identity Resource used for the Bot's Authentication. Defaults to \"\"."
|
|
}
|
|
},
|
|
"UMSIResourceGroupName": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"description": "The User-Assigned Managed Identity Resource Group used for the Bot's Authentication. Defaults to \"\"."
|
|
}
|
|
},
|
|
"tenantId": {
|
|
"type": "string",
|
|
"defaultValue": "[subscription().tenantId]",
|
|
"metadata": {
|
|
"description": "The Azure AD Tenant ID to use as part of the Bot's Authentication. Only used for SingleTenant and UserAssignedMSI app types. Defaults to \"Subscription Tenant ID\"."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"tenantId": "[if(empty(parameters('tenantId')), subscription().tenantId, parameters('tenantId'))]",
|
|
"defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlanName')), 'createNewAppServicePlan', parameters('existingAppServicePlanName'))]",
|
|
"useExistingServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]",
|
|
"servicePlanName": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanName'), parameters('newAppServicePlanName'))]",
|
|
"servicePlanLocation": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanLocation'), parameters('newAppServicePlanLocation'))]",
|
|
"msiResourceId": "[concat(subscription().id, '/resourceGroups/', parameters('UMSIResourceGroupName'), '/providers/', 'Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('UMSIName'))]",
|
|
"appTypeDef": {
|
|
"MultiTenant": {
|
|
"tenantId": "",
|
|
"identity": { "type": "None" }
|
|
},
|
|
"SingleTenant": {
|
|
"tenantId": "[variables('tenantId')]",
|
|
"identity": { "type": "None" }
|
|
},
|
|
"UserAssignedMSI": {
|
|
"tenantId": "[variables('tenantId')]",
|
|
"identity": {
|
|
"type": "UserAssigned",
|
|
"userAssignedIdentities": {
|
|
"[variables('msiResourceId')]": {}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"appType": {
|
|
"tenantId": "[variables('appTypeDef')[parameters('appType')].tenantId]",
|
|
"identity": "[variables('appTypeDef')[parameters('appType')].identity]"
|
|
}
|
|
},
|
|
"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('useExistingServicePlan'))]",
|
|
"name": "[variables('servicePlanName')]",
|
|
"apiVersion": "2018-02-01",
|
|
"location": "[parameters('newAppServicePlanLocation')]",
|
|
"sku": "[parameters('newAppServicePlanSku')]",
|
|
"properties": {
|
|
"name": "[variables('servicePlanName')]"
|
|
}
|
|
},
|
|
{
|
|
"comments": "Create a Web App using an App Service Plan",
|
|
"type": "Microsoft.Web/sites",
|
|
"apiVersion": "2015-08-01",
|
|
"location": "[variables('servicePlanLocation')]",
|
|
"kind": "app",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]"
|
|
],
|
|
"name": "[parameters('appServiceName')]",
|
|
"identity": "[variables('appType').identity]",
|
|
"properties": {
|
|
"name": "[parameters('appServiceName')]",
|
|
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]",
|
|
"siteConfig": {
|
|
"appSettings": [
|
|
{
|
|
"name": "WEBSITE_NODE_DEFAULT_VERSION",
|
|
"value": "10.14.1"
|
|
},
|
|
{
|
|
"name": "MicrosoftAppType",
|
|
"value": "[parameters('appType')]"
|
|
},
|
|
{
|
|
"name": "MicrosoftAppId",
|
|
"value": "[parameters('appId')]"
|
|
},
|
|
{
|
|
"name": "MicrosoftAppPassword",
|
|
"value": "[parameters('appSecret')]"
|
|
},
|
|
{
|
|
"name": "MicrosoftAppTenantId",
|
|
"value": "[variables('appType').tenantId]"
|
|
}
|
|
],
|
|
"cors": {
|
|
"allowedOrigins": [
|
|
"https://botservice.hosting.portal.azure.net",
|
|
"https://hosting.onecloud.azure-test.net/"
|
|
]
|
|
},
|
|
"webSocketsEnabled": true
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |