Botbuilder-samples: Deploying via ARM Template (with new Resource Group) failed with Error in Python samples

Created on 12 Jul 2020  路  11Comments  路  Source: microsoft/BotBuilder-Samples

Github issues for Python should be used for bugs and feature requests

Sample information

  1. Sample type: [samples/python/*/deploymentTemplates/template-with-new-rg.json]
  2. Sample language: [python Arm Templates]
  3. Sample name: I tried "18.bot-authentication/deploymentTemplates/template-with-new-rg.json"

Describe the bug

Deploying via ARM Template (with new Resource Group) failed with Error on Python samples

I tried to deploy resources via ARM Templates with new resource group but failed with error.

InvalidTemplate - Deployment template validation failed: 'The resource 'Microsoft.Web/serverfarms/my-asp' is not defined in the template. Please see https://aka.ms/arm-template for usage details.'.

Command what I tried:

I deployed successfully without Web App or with existing resource group.

az deployment sub create 
    --template-file "deploymentTemplates/template-with-new-rg.json" 
    --location japaneast 
    --parameters 
        appId="xxxxxxxxxxxxxxx" 
        appSecret="xxxxxxxxxxxxxxxxx" 
        botId="myTestBot" 
        newWebAppName="myTestBot" 
        newAppServicePlanName="my-asp" 
        botSku=F0 
        groupName="my-bot-rg" 
        groupLocation="japaneast" 
        newAppServicePlanLocation="japaneast" 
    --name "myTestBot"

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'samples/python/18.bot-authentication/deploymentTemplates'
  2. Run a command written in the document
  3. See error

Expected behavior

Deploying resources via ARM Template with new Resource group.

[bug]

Bot Services customer-replied-to customer-reported

Most helpful comment

Hello,

I have faced the same issue (with the C# sample, but the ARM templates are probably the same?). It could be fixed for me by changing https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/02.echo-bot/DeploymentTemplates/template-with-new-rg.json as follows:

@@ -121,7 +121,7 @@
                             "location": "[variables('resourcesLocation')]",
                             "kind": "app",
                             "dependsOn": [
-                                "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]"
+                                "[variables('appServicePlanName')]"
                             ],
                             "name": "[variables('webAppName')]",
                             "properties": {
@@ -172,7 +172,7 @@
                                 "storageResourceId": null
                             },
                             "dependsOn": [
-                                "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]"
+                                "[variables('webAppName')]"
                             ]
                         }
                     ],

Edit: Put patch into code block.

All 11 comments

Just to be clear, if you go on Azure and create the new (empty) resource group, then run the command to deploy to existing RG to this new one, it works, but if you run the command to deploy to a new RG (which should, in effect, create an RG for you), it doesn't work?

@jwiley84

Yes. creating a new empty resource group on Azure Portal at first, then deploying via ARM Template (template-with-preexisting-rg.json) works.

However, creating all resources with a new resource group (template-with-new-rg.json) from azcli didn't work.

Hello,

I have faced the same issue (with the C# sample, but the ARM templates are probably the same?). It could be fixed for me by changing https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/02.echo-bot/DeploymentTemplates/template-with-new-rg.json as follows:

@@ -121,7 +121,7 @@
                             "location": "[variables('resourcesLocation')]",
                             "kind": "app",
                             "dependsOn": [
-                                "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]"
+                                "[variables('appServicePlanName')]"
                             ],
                             "name": "[variables('webAppName')]",
                             "properties": {
@@ -172,7 +172,7 @@
                                 "storageResourceId": null
                             },
                             "dependsOn": [
-                                "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]"
+                                "[variables('webAppName')]"
                             ]
                         }
                     ],

Edit: Put patch into code block.

@commakoerschgen

I really appreciate you.

The first error I met was resolved with your help but I faced a new error.

InvalidTemplate - Deployment template validation failed: 'The template resource 'Microsoft.BotService/botServices/myTestBot' cannot reference itself. Please see https://aka.ms/arm-template-expressions/#reference for usage details.'.

I deleted dependsOn property on BotService then fixed.

"dependsOn": [
    "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]"
]
"dependsOn": [

]

Thank you again.

Apologies for the delay. I'll reach out to the author of the ARM templates and see if anything has changed on Azure to prevent the bots from being deployed as it. Thank you for bringing this to our attention.

Hi @kemurayama

There's something going on with the ARM template deploy-to-new-RG. It's being investigated by the team, but right now, the work around is to create an empty resource group on Azure, then run the command to deploy-to-existing-RG.

I'll update this when I get an answer from the team looking into the problem.

Hi @jwiley84

I managed to create resources by modifying dependsOn properties in 'template-with-new-rg.json' like below.
Tested on '02.echo-bot\deploymentTemplates\template-with-new-rg.json'.

@@L129 ~ 131

"dependsOn": [
    "[variables('appServicePlanName')]"
],

@@L177 ~ 179

"dependsOn": [
    "[variables('webAppName')]"
],

@@L254 ~ 256

"dependsOn": [

],

Hi @kemurayama There is potential fix in the work right now, and hopefully should be cut soon. Thank you for your patience in this!

@jwiley84 any update?

got it working on empty resource group and preexisting.json as well

Thank you for your patience. They're testing the new ARM templates, and a fix should be out soon.

https://github.com/microsoft/BotBuilder-Samples/issues/2631

Thank you for your patience on this. The ARM templates have been updated. Please use an ARM template from a current sample and attempt to redeploy. I'm going to close this issue. If you continue to have the same problem with deploying, please comment and I will reopen.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clearab picture clearab  路  4Comments

ashutoshpith picture ashutoshpith  路  8Comments

EricDahlvang picture EricDahlvang  路  9Comments

Batta32 picture Batta32  路  9Comments

arunprasathv picture arunprasathv  路  3Comments