diff --git a/samples/02.echo-bot/README.md b/samples/02.echo-bot/README.md index a89774b04..246459b59 100644 --- a/samples/02.echo-bot/README.md +++ b/samples/02.echo-bot/README.md @@ -54,10 +54,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/02.echo-bot/deploymentTemplates/template-with-new-rg.json b/samples/02.echo-bot/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/02.echo-bot/deploymentTemplates/template-with-new-rg.json +++ b/samples/02.echo-bot/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/03.welcome-user/README.md b/samples/03.welcome-user/README.md index e65396c03..a1f6435a3 100644 --- a/samples/03.welcome-user/README.md +++ b/samples/03.welcome-user/README.md @@ -54,10 +54,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/03.welcome-user/deploymentTemplates/template-with-new-rg.json b/samples/03.welcome-user/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/03.welcome-user/deploymentTemplates/template-with-new-rg.json +++ b/samples/03.welcome-user/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/05.multi-turn-prompt/README.md b/samples/05.multi-turn-prompt/README.md index e4375c425..5a9e2a472 100644 --- a/samples/05.multi-turn-prompt/README.md +++ b/samples/05.multi-turn-prompt/README.md @@ -54,10 +54,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/05.multi-turn-prompt/deploymentTemplates/template-with-new-rg.json b/samples/05.multi-turn-prompt/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/05.multi-turn-prompt/deploymentTemplates/template-with-new-rg.json +++ b/samples/05.multi-turn-prompt/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/06.using-cards/README.md b/samples/06.using-cards/README.md index ddfdce522..38d2a17bc 100644 --- a/samples/06.using-cards/README.md +++ b/samples/06.using-cards/README.md @@ -67,10 +67,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/06.using-cards/deploymentTemplates/template-with-new-rg.json b/samples/06.using-cards/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/06.using-cards/deploymentTemplates/template-with-new-rg.json +++ b/samples/06.using-cards/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/08.suggested-actions/README.md b/samples/08.suggested-actions/README.md index 40dcd231e..b6a6ea967 100644 --- a/samples/08.suggested-actions/README.md +++ b/samples/08.suggested-actions/README.md @@ -54,10 +54,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/08.suggested-actions/deploymentTemplates/template-with-new-rg.json b/samples/08.suggested-actions/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/08.suggested-actions/deploymentTemplates/template-with-new-rg.json +++ b/samples/08.suggested-actions/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/16.proactive-messages/README.md b/samples/16.proactive-messages/README.md index dc35a0cee..eefe97d13 100644 --- a/samples/16.proactive-messages/README.md +++ b/samples/16.proactive-messages/README.md @@ -63,10 +63,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/16.proactive-messages/deploymentTemplates/template-with-new-rg.json b/samples/16.proactive-messages/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/16.proactive-messages/deploymentTemplates/template-with-new-rg.json +++ b/samples/16.proactive-messages/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/17.multilingual-bot/README.md b/samples/17.multilingual-bot/README.md index 16ddd7477..417f3d110 100644 --- a/samples/17.multilingual-bot/README.md +++ b/samples/17.multilingual-bot/README.md @@ -58,7 +58,48 @@ The API uses the most modern neural machine translation technology, as well as o ## Deploy this bot to Azure -To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions. +As described on [Deploy your bot](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-deploy-az-cli), you will perform the first 4 steps to setup the Azure app, then deploy the code using the azure-webapp Maven plugin. + +### 1. Login to Azure +From a command (or PowerShell) prompt in the root of the bot folder, execute: +`az login` + +### 2. Set the subscription +`az account set --subscription ""` + +If you aren't sure which subscription to use for deploying the bot, you can view the list of subscriptions for your account by using `az account list` command. + +### 3. Create an App registration +`az ad app create --display-name "" --password "" --available-to-other-tenants` + +Replace `` and `` with your own values. + +`` is the unique name of your bot. +`` is a minimum 16 character password for your bot. + +Record the `appid` from the returned JSON + +### 4. Create the Azure resources +Replace the values for ``, ``, ``, and `` in the following commands: + +#### To a new Resource Group +`az deployment sub create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` + +#### To an existing Resource Group +`az group deployment sub create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` + +### 5. Update app id and password +In src/main/resources/application.properties update +- `MicrosoftAppPassword` with the botsecret value +- `MicrosoftAppId` with the appid from the first step + +### 6. Deploy the code +- Execute `mvn clean package` +- Execute `mvn azure-webapp:deploy -Dgroupname="" -Dbotname=""` + +If the deployment is successful, you will be able to test it via "Test in Web Chat" from the Azure Portal using the "Bot Channel Registration" for the bot. + +After the bot is deployed, you only need to execute #6 if you make changes to the bot. ### Add `TranslatorKey` to Application Settings diff --git a/samples/17.multilingual-bot/deploymentTemplates/template-with-new-rg.json b/samples/17.multilingual-bot/deploymentTemplates/template-with-new-rg.json index 3a0e81219..c951bc908 100644 --- a/samples/17.multilingual-bot/deploymentTemplates/template-with-new-rg.json +++ b/samples/17.multilingual-bot/deploymentTemplates/template-with-new-rg.json @@ -3,6 +3,7 @@ "contentVersion": "1.0.0.0", "parameters": { "groupLocation": { + "defaultValue": "", "type": "string", "metadata": { "description": "Specifies the location of the Resource Group." @@ -33,12 +34,14 @@ } }, "botSku": { + "defaultValue": "F0", "type": "string", "metadata": { "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." } }, "newAppServicePlanName": { + "defaultValue": "", "type": "string", "metadata": { "description": "The name of the App Service Plan." @@ -47,10 +50,10 @@ "newAppServicePlanSku": { "type": "object", "defaultValue": { - "name": "S1", - "tier": "Standard", - "size": "S1", - "family": "S", + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", "capacity": 1 }, "metadata": { @@ -58,6 +61,7 @@ } }, "newAppServicePlanLocation": { + "defaultValue": "", "type": "string", "metadata": { "description": "The location of the App Service Plan. Defaults to \"westus\"." @@ -72,8 +76,10 @@ } }, "variables": { - "appServicePlanName": "[parameters('newAppServicePlanName')]", - "resourcesLocation": "[parameters('newAppServicePlanLocation')]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", + "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", + "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", @@ -84,8 +90,9 @@ "name": "[parameters('groupName')]", "type": "Microsoft.Resources/resourceGroups", "apiVersion": "2018-05-01", - "location": "[parameters('groupLocation')]", - "properties": {} + "location": "[variables('effectiveGroupLocation')]", + "properties": { + } }, { "type": "Microsoft.Resources/deployments", @@ -110,8 +117,10 @@ "apiVersion": "2018-02-01", "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", + "kind": "linux", "properties": { - "name": "[variables('appServicePlanName')]" + "name": "[variables('appServicePlanName')]", + "reserved":true } }, { @@ -130,8 +139,8 @@ "siteConfig": { "appSettings": [ { - "name": "WEBSITE_NODE_DEFAULT_VERSION", - "value": "10.14.1" + "name": "JAVA_OPTS", + "value": "-Dserver.port=80" }, { "name": "MicrosoftAppId", diff --git a/samples/44.prompt-users-for-input/README.md b/samples/44.prompt-users-for-input/README.md index 1a7f0a8e7..0ea71b0e0 100644 --- a/samples/44.prompt-users-for-input/README.md +++ b/samples/44.prompt-users-for-input/README.md @@ -54,10 +54,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/44.prompt-users-for-input/deploymentTemplates/template-with-new-rg.json b/samples/44.prompt-users-for-input/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/44.prompt-users-for-input/deploymentTemplates/template-with-new-rg.json +++ b/samples/44.prompt-users-for-input/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/45.state-management/README.md b/samples/45.state-management/README.md index d7fda09ec..875ef97b1 100644 --- a/samples/45.state-management/README.md +++ b/samples/45.state-management/README.md @@ -57,10 +57,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "stateBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "stateBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/45.state-management/deploymentTemplates/template-with-new-rg.json b/samples/45.state-management/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/45.state-management/deploymentTemplates/template-with-new-rg.json +++ b/samples/45.state-management/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/47.inspection/README.md b/samples/47.inspection/README.md index c789de873..641081aae 100644 --- a/samples/47.inspection/README.md +++ b/samples/47.inspection/README.md @@ -69,10 +69,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/47.inspection/deploymentTemplates/template-with-new-rg.json b/samples/47.inspection/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/47.inspection/deploymentTemplates/template-with-new-rg.json +++ b/samples/47.inspection/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/50.teams-messaging-extensions-search/deploymentTemplates/template-with-new-rg.json b/samples/50.teams-messaging-extensions-search/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/50.teams-messaging-extensions-search/deploymentTemplates/template-with-new-rg.json +++ b/samples/50.teams-messaging-extensions-search/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/51.teams-messaging-extensions-action/deploymentTemplates/template-with-new-rg.json b/samples/51.teams-messaging-extensions-action/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/51.teams-messaging-extensions-action/deploymentTemplates/template-with-new-rg.json +++ b/samples/51.teams-messaging-extensions-action/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/52.teams-messaging-extensions-search-auth-config/deploymentTemplates/template-with-new-rg.json b/samples/52.teams-messaging-extensions-search-auth-config/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/52.teams-messaging-extensions-search-auth-config/deploymentTemplates/template-with-new-rg.json +++ b/samples/52.teams-messaging-extensions-search-auth-config/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/53.teams-messaging-extensions-action-preview/deploymentTemplates/template-with-new-rg.json b/samples/53.teams-messaging-extensions-action-preview/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/53.teams-messaging-extensions-action-preview/deploymentTemplates/template-with-new-rg.json +++ b/samples/53.teams-messaging-extensions-action-preview/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/54.teams-task-module/deploymentTemplates/template-with-new-rg.json b/samples/54.teams-task-module/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/54.teams-task-module/deploymentTemplates/template-with-new-rg.json +++ b/samples/54.teams-task-module/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/55.teams-link-unfurling/deploymentTemplates/template-with-new-rg.json b/samples/55.teams-link-unfurling/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/55.teams-link-unfurling/deploymentTemplates/template-with-new-rg.json +++ b/samples/55.teams-link-unfurling/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/56.teams-file-upload/deploymentTemplates/template-with-new-rg.json b/samples/56.teams-file-upload/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/56.teams-file-upload/deploymentTemplates/template-with-new-rg.json +++ b/samples/56.teams-file-upload/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/57.teams-conversation-bot/deploymentTemplates/template-with-new-rg.json b/samples/57.teams-conversation-bot/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/57.teams-conversation-bot/deploymentTemplates/template-with-new-rg.json +++ b/samples/57.teams-conversation-bot/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json index dcd6260a5..c951bc908 100644 --- a/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json +++ b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -129,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -179,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], diff --git a/samples/servlet-echo/README.md b/samples/servlet-echo/README.md index 0b08a5371..53f981d88 100644 --- a/samples/servlet-echo/README.md +++ b/samples/servlet-echo/README.md @@ -36,10 +36,10 @@ Record the `appid` from the returned JSON Replace the values for ``, ``, ``, and `` in the following commands: #### To a new Resource Group -`az deployment create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` +`az deployment sub create --name "echoBotDeploy" --location "westus" --template-file ".\deploymentTemplates\template-with-new-rg.json" --parameters groupName="" botId="" appId="" appSecret=""` #### To an existing Resource Group -`az group deployment create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` +`az group deployment sub create --name "echoBotDeploy" --resource-group "" --template-file ".\deploymentTemplates\template-with-preexisting-rg.json" --parameters botId="" appId="" appSecret=""` ### 5. Update app id and password In src/main/resources/application.properties update diff --git a/samples/servlet-echo/deploymentTemplates/template-with-new-rg-gov.json b/samples/servlet-echo/deploymentTemplates/template-with-new-rg-gov.json index d5264be99..097476a7f 100644 --- a/samples/servlet-echo/deploymentTemplates/template-with-new-rg-gov.json +++ b/samples/servlet-echo/deploymentTemplates/template-with-new-rg-gov.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.us')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,7 +115,7 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "app", "properties": { @@ -128,7 +129,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -180,7 +181,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], @@ -189,4 +190,4 @@ } } ] -} +} \ No newline at end of file diff --git a/samples/servlet-echo/deploymentTemplates/template-with-new-rg.json b/samples/servlet-echo/deploymentTemplates/template-with-new-rg.json index b12b7056f..c951bc908 100644 --- a/samples/servlet-echo/deploymentTemplates/template-with-new-rg.json +++ b/samples/servlet-echo/deploymentTemplates/template-with-new-rg.json @@ -76,13 +76,14 @@ } }, "variables": { - "resourcesLocation": "[deployment().location]", + "resourcesLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]", - "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]", + "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), deployment().location, parameters('newAppServicePlanLocation'))]", "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]", "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", + "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ { @@ -114,11 +115,12 @@ "type": "Microsoft.Web/serverfarms", "name": "[variables('appServicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('effectivePlanLocation')]", + "location": "[variables('resourcesLocation')]", "sku": "[parameters('newAppServicePlanSku')]", - "kind": "app", + "kind": "linux", "properties": { - "name": "[variables('appServicePlanName')]" + "name": "[variables('appServicePlanName')]", + "reserved":true } }, { @@ -128,7 +130,7 @@ "location": "[variables('resourcesLocation')]", "kind": "app", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "name": "[variables('webAppName')]", "properties": { @@ -178,7 +180,7 @@ "storageResourceId": null }, "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" ] } ], @@ -187,4 +189,4 @@ } } ] -} +} \ No newline at end of file