TU Tran

Technologies should serve for business purpose.

NAVIGATION - SEARCH

Issue with Azure Bot Deployment

I'm testing to check if I can deploy a dummy bot to Azure Bot Services and run it across multiple channels. I'm using Azure CLI to deploy the bot on ubuntu. The command I ran was, (found on Bot SDK official documentaion)

az deployment sub create --template-file "/home/abrar/Work/Bot_POC/testbot-1/deploymentTemplates/template-with-new-rg.json" --location centralindia --parameters appType="UserAssignedMSI" appId="blablabla" tenantId="blablabla2" existingUserAssignedMSIName="TitanBotName" existingUserAssignedMSIResourceGroupName="TitanBot" botId="/subscriptions/2d178cfc-3973-4e06-9ffe-15463849a46c/resourcegroups/TitanBot/providers/Microsoft.ManagedIdentity/userAssignedIdentities/TitanBotName" botSku=S1 newAppServicePlanName="titanbot" newWebAppName="TitanAssistBot" groupName="TitanBot" groupLocation="centralindia" newAppServicePlanLocation="centralindia" --name "TitanAssist"

I've changed the appId and tenantId just in case for this post. The error I'm receiving is,

{'code': 'InvalidTemplate', 'target': '/subscriptions/2d178cfc-3973-4e06-9ffe-15463849a46c/resourceGroups/TitanBot/providers/Microsoft.Resources/deployments/storageDeployment', 'message': "Deployment template validation failed: 'The template resource '/subscriptions/2d178cfc-3973-4e06-9ffe-15463849a46c/resourcegroups/TitanBot/providers/Microsoft.ManagedIdentity/userAssignedIdentities/TitanBotName' for type 'Microsoft.BotService/botServices' at line '1' and column '2061' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-template/#resources for usage details.'.", 'additionalInfo': [{'type': 'TemplateViolation', 'info': {'lineNumber': 1, 'linePosition': 2061, 'path': 'properties.template.resources[2].type'}}]}

From the error I'm assuming the template-with-new-rg.json has some issues. I got the file from creating an empty bot from Yeoman bot-builder-generator. Upon checking the file I noticed that it had a couple of errors. Link to the file https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/javascript_nodejs/02.echo-bot/deploymentTemplates/template-with-new-rg.json

I'm not sure what to do from here, I've tried fixing the json file as suggested by VSCode terminal and upon fixing those, I'm getting another type of error.

{'code': 'InvalidTemplate', 'message': "Deployment template validation failed: 'The template resource 'storageDeployment' at line '152' and column '9' is invalid. 'ResourceGroup' property is not supported for nested deployments with api-version older than '2017-05-10'. Please see https://aka.ms/arm-template/#resources for usage details.'.", 'additionalInfo': [{'type': 'TemplateViolation', 'info': {'lineNumber': 152, 'linePosition': 9, 'path': 'properties.template.resources[1]'}}]}

Any suggestions on what I can do now?

 

Solution:

There are a few of things wrong here that I can see immediately.

Firstly, botid is the name of the bot, not an ID number or subscription number. Enter a unique bot name here, such as "TitanTestBot1". This name must be unique across Azure, as Azure Bot resources cannot be created in a specific region and are always global.

Additionally, your service plan name is also titanbot. Try giving it a better name.

Finally, you're telling Azure the resource group that your managed identity (which must already exist before creating a bot resource) exists in is called TitanBot, but you're also saying you want to create a new resource group for the bot resources called TitanBot. These two things cannot both be true. If you want the bot resources to go into TitanBot, you need to use the preexisting-rg template, not the new-rg template. If you want a new resource group, it must have a new name.

At this point, you should carefully review all of the fields in the Publish your bot to Azure docs and make sure you're giving each field a unique and correct entry.

 

 

 

Add comment