Forum Discussion
arie_schwartzman
Dec 21, 2022Microsoft
Automate Health Bot Deployment using Bicep
Health Bot Azure resource provider now supports retrieval of secrets using the ARM API.
This will allow the automated deployment of Health Bot and any other resources that rely on the various secrets that the bot resource exposes.
In this example, we show how to deploy Health Bot and a Web Application that uses the Container sample, wire up the secrets the app needs to communicate with the bot and even upload bot template that resides on a publicly accessible storage account via the Data plane API using a PowerShell deployment script.
For the complete Bicep code and the restoreBot.ps1 file, see the attached bicep.zip file.
param serviceName string
param linuxFxVersion string = 'node|14-lts'
param farmSKU string = 'F1'
param botSKU string = 'F0'
param location string = 'eastus'
param hbsRestoreFile string = 'https://xxxxxxxxx.blob.core.windows.net/templates/botTemplate.hbs'
resource healthbot 'Microsoft.HealthBot/healthBots@2022-08-08' = {
name: '${serviceName}-bot'
location: location
properties: {
keyVaultProperties: {
keyName: 'string'
keyVaultUri: 'string'
keyVersion: 'string'
userIdentity: 'string'
}
}
sku: {
name: botSKU
}
}
resource farm 'Microsoft.Web/serverfarms@2022-03-01' = {
location: location
name: '${serviceName}-farm'
kind: 'linux'
sku: {
name: farmSKU
}
properties: {
reserved: true
}
}
resource webapp 'Microsoft.Web/sites@2022-03-01' = {
name: '${serviceName}-webapp'
location: location
properties: {
serverFarmId: farm.id
siteConfig: {
linuxFxVersion: linuxFxVersion
appSettings: [
{
name: 'PORT'
value: '80'
}
{
name: 'APP_SECRET'
value: healthbot.listSecrets().secrets[0].value
}
{
name: 'WEBCHAT_SECRET'
value: healthbot.listSecrets().secrets[1].value
}
]
}
}
}
resource srcControls 'Microsoft.Web/sites/sourcecontrols@2021-01-01' = {
name: '${webapp.name}/web'
properties: {
repoUrl: 'https://github.com/microsoft/HealthBotContainerSample'
branch: 'master'
isManualIntegration: true
}
}
resource importBotScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: '${serviceName}-RestoreBotScript'
location: location
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '3.0'
scriptContent: loadTextContent('restoreBot.ps1')
retentionInterval: 'P1D'
arguments: '-secret ${healthbot.listSecrets().secrets[2].value} -baseUrl ${healthbot.properties.botManagementPortalLink} -hbsRestoreFile ${hbsRestoreFile}'
}
}
No RepliesBe the first to reply