Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions build/templates/template-function-dotnet-bot-resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appId": {
"type": "string",
"metadata": {
"description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings."
}
},
"appSecret": {
"type": "string",
"metadata": {
"description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings."
}
},
"botName": {
"type": "string"
},
"botLocation": {
"type": "string"
},
"appInsightsName": {
"type": "string",
"defaultValue": ""
},
"appServicePlanName": {
"type": "string"
},
"appServicePlanResourceGroup": {
"type": "string"
},
"botSku": {
"type": "string",
"defaultValue": "F0",
"metadata": {
"description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1."
}
}
},
"variables": {
"siteHost": "[concat(parameters('botName'), '.azurewebsites.net')]",
"botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]",
"publishingUsername": "[concat('$', parameters('botName'))]"
},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2015-08-01",
"location": "[parameters('botLocation')]",
"kind": "functionapp",
"name": "[parameters('botName')]",
"properties": {
"name": "[parameters('botName')]",
"kind": "functionapp",
"httpsOnly": true,
"alwaysOn": true,
"webSocketsEnabled": true
},
"resources": [
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', parameters('botName'))]"
],
"properties": {
"FUNCTIONS_EXTENSION_VERSION": "~3",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"APPINSIGHTS_INSTRUMENTATIONKEY": "[if(empty(parameters('appInsightsName')), '', reference(resourceId(parameters('appServicePlanResourceGroup'),'Microsoft.Insights/components', parameters('appInsightsName')), '2015-05-01', 'Full').properties.InstrumentationKey)]",
"MicrosoftAppId": "[parameters('appId')]",
"MicrosoftAppPassword": "[parameters('appSecret')]"
}
}
]
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2020-09-01",
"name": "[concat(parameters('botName'), '/', parameters('botName'), '.azurewebsites.net')]",
"location": "[parameters('botLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('botName'))]"
],
"properties": {
"siteName": "[parameters('botName')]",
"hostNameType": "Verified"
}
},
{
"type": "Microsoft.BotService/botServices",
"apiVersion": "2020-06-02",
"name": "[parameters('botName')]",
"location": "global",
"kind": "bot",
"sku": {
"name": "[parameters('botSku')]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('botName'))]"
],
"properties": {
"name": "[parameters('botName')]",
"displayName": "[parameters('botName')]",
"endpoint": "[variables('botEndpoint')]",
"msaAppId": "[parameters('appId')]",
"developerAppInsightsApplicationId": "",
"developerAppInsightKey": "",
"publishingCredentials": null,
"storageResourceId": null
}
}
]
}
116 changes: 116 additions & 0 deletions build/templates/template-function-js-bot-resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appId": {
"type": "string",
"metadata": {
"description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings."
}
},
"appSecret": {
"type": "string",
"metadata": {
"description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings."
}
},
"botName": {
"type": "string"
},
"botLocation": {
"type": "string"
},
"appInsightsName": {
"type": "string",
"defaultValue": ""
},
"appServicePlanName": {
"type": "string"
},
"appServicePlanResourceGroup": {
"type": "string"
},
"botSku": {
"type": "string",
"defaultValue": "F0",
"metadata": {
"description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1."
}
}
},
"variables": {
"siteHost": "[concat(parameters('botName'), '.azurewebsites.net')]",
"botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]",
"publishingUsername": "[concat('$', parameters('botName'))]"
},
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2015-08-01",
"location": "[parameters('botLocation')]",
"kind": "functionapp",
"name": "[parameters('botName')]",
"properties": {
"name": "[parameters('botName')]",
"kind": "functionapp",
"httpsOnly": true,
"alwaysOn": true,
"webSocketsEnabled": true
},
"resources": [
{
"name": "appsettings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', parameters('botName'))]"
],
"properties": {
"FUNCTIONS_EXTENSION_VERSION": "~3",
"FUNCTIONS_WORKER_RUNTIME": "node",
"WEBSITE_NODE_DEFAULT_VERSION": "~14",
"APPINSIGHTS_INSTRUMENTATIONKEY": "[if(empty(parameters('appInsightsName')), '', reference(resourceId(parameters('appServicePlanResourceGroup'),'Microsoft.Insights/components', parameters('appInsightsName')), '2015-05-01', 'Full').properties.InstrumentationKey)]",
"MicrosoftAppId": "[parameters('appId')]",
"MicrosoftAppPassword": "[parameters('appSecret')]"
}
}
]
},
{
"type": "Microsoft.Web/sites/hostNameBindings",
"apiVersion": "2020-09-01",
"name": "[concat(parameters('botName'), '/', parameters('botName'), '.azurewebsites.net')]",
"location": "[parameters('botLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('botName'))]"
],
"properties": {
"siteName": "[parameters('botName')]",
"hostNameType": "Verified"
}
},
{
"type": "Microsoft.BotService/botServices",
"apiVersion": "2020-06-02",
"name": "[parameters('botName')]",
"location": "global",
"kind": "bot",
"sku": {
"name": "[parameters('botSku')]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('botName'))]"
],
"properties": {
"name": "[parameters('botName')]",
"displayName": "[parameters('botName')]",
"endpoint": "[variables('botEndpoint')]",
"msaAppId": "[parameters('appId')]",
"developerAppInsightsApplicationId": "",
"developerAppInsightKey": "",
"publishingCredentials": null,
"storageResourceId": null
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ public enum HostBot
/// </summary>
EmptyBotDotNetWebApp,

/// <summary>
/// Empty bot implemented using DotNet and Functions.
/// </summary>
EmptyBotDotNetFunctions,

/// <summary>
/// Empty bot implemented using JS and Web App.
/// </summary>
EmptyBotJSWebApp
EmptyBotJSWebApp,

/// <summary>
/// Empty bot implemented using JS and Functions.
/// </summary>
EmptyBotJSFunctions
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public static IEnumerable<object[]> TestCases()
var hostBots = new List<HostBot>
{
HostBot.EmptyBotDotNetWebApp,
HostBot.EmptyBotJSWebApp
HostBot.EmptyBotDotNetFunctions,
HostBot.EmptyBotJSWebApp,
HostBot.EmptyBotJSFunctions
};

var scripts = new List<string> { "EmptyBot.json" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@
"BotId": "bfcfnemptybotdotnetwebapp",
"DirectLineSecret": ""
},
"EmptyBotDotNetFunctions": {
"BotId": "bfcfnemptybotdotnetfunctions",
"DirectLineSecret": ""
},
"EmptyBotJSWebApp": {
"BotId": "bfcfnemptybotjswebapp",
"DirectLineSecret": ""
},
"EmptyBotJSFunctions": {
"BotId": "bfcfnemptybotjsfunctions",
"DirectLineSecret": ""
}
}
}
71 changes: 49 additions & 22 deletions tests/functional/build/yaml/deployBotResources/dotnet/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,30 +154,57 @@ stages:
pathToPublish: "$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ parameters.buildFolder }}/${{ bot.name }}/${{ bot.name }}.zip"
artifactName: dotnet-$(BUILD.BUILDID)

- ${{ if eq(bot.project.integration, 'webapp') }}:
# Create App Service and Bot Channel Registration
- template: ../common/createAppService.yml
parameters:
appId: $(APPID)
appInsight: "${{ parameters.appInsight }}"
appSecret: $(APPSECRET)
appServicePlan: "${{ parameters.appServicePlan }}"
appServicePlanRG: "${{ parameters.appServicePlanRG }}"
azureSubscription: "${{ parameters.azureSubscription }}"
botGroup: "${{ parameters.resourceGroup }}"
botName: "${{ bot.name }}"
botPricingTier: "${{ parameters.botPricingTier }}"
resourceSuffix: "${{ parameters.resourceSuffix }}"
templateFile: "build/templates/template-bot-resources.json"
- template: ../common/createAppService.yml
parameters:
appId: $(APPID)
appInsight: "${{ parameters.appInsight }}"
appSecret: $(APPSECRET)
appServicePlan: "${{ parameters.appServicePlan }}"
appServicePlanRG: "${{ parameters.appServicePlanRG }}"
azureSubscription: "${{ parameters.azureSubscription }}"
botGroup: "${{ parameters.resourceGroup }}"
botName: "${{ bot.name }}"
botPricingTier: "${{ parameters.botPricingTier }}"
resourceSuffix: "${{ parameters.resourceSuffix }}"
templateFile: "build/templates/template-bot-resources.json"

# Deploy bot
- task: AzureWebApp@1
displayName: 'Deploy Azure Web App : ${{ bot.name }}-$(BUILD.BUILDID)'
inputs:
azureSubscription: "${{ parameters.azureSubscription }}"
appName: '${{ bot.name }}${{ parameters.resourceSuffix }}-$(BUILD.BUILDID)'
resourceGroupName: '${{ parameters.resourceGroup }}'
package: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ parameters.buildFolder }}/${{ bot.name }}/${{ bot.name }}.zip'
deploymentMethod: runFromPackage
# Deploy bot to Azure Web App
- task: AzureWebApp@1
displayName: 'Deploy Azure Web App : ${{ bot.name }}-$(BUILD.BUILDID)'
inputs:
azureSubscription: "${{ parameters.azureSubscription }}"
appName: '${{ bot.name }}${{ parameters.resourceSuffix }}-$(BUILD.BUILDID)'
resourceGroupName: '${{ parameters.resourceGroup }}'
package: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ parameters.buildFolder }}/${{ bot.name }}/${{ bot.name }}.zip'
deploymentMethod: runFromPackage

- ${{ if eq(bot.project.integration, 'functions') }}:
# Create Functions App and Bot Channel Registration
- template: ../common/createAppService.yml
parameters:
appId: $(APPID)
appInsight: "${{ parameters.appInsight }}"
appSecret: $(APPSECRET)
appServicePlan: "${{ parameters.appServicePlan }}"
appServicePlanRG: "${{ parameters.appServicePlanRG }}"
azureSubscription: "${{ parameters.azureSubscription }}"
botGroup: "${{ parameters.resourceGroup }}"
botName: "${{ bot.name }}"
botPricingTier: "${{ parameters.botPricingTier }}"
resourceSuffix: "${{ parameters.resourceSuffix }}"
templateFile: "build/templates/template-function-dotnet-bot-resources.json"

# Deploy bot to Azure Functions
- task: AzureFunctionApp@1
displayName: 'Deploy Functions App : ${{ bot.name }}-$(BUILD.BUILDID)'
inputs:
azureSubscription: "${{ parameters.azureSubscription }}"
appType: 'functionApp'
appName: '${{ bot.name }}${{ parameters.resourceSuffix }}-$(BUILD.BUILDID)'
package: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ parameters.buildFolder }}/${{ bot.name }}/${{ bot.name }}.zip'
deploymentMethod: runFromPackage

# Configure OAuth
- ${{ if eq(bot.type, 'Skill') }}:
Expand Down
Loading