diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json new file mode 100644 index 000000000..cc1800c0d --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "azureBotId": { + "value": "" + }, + "azureBotSku": { + "value": "S1" + }, + "azureBotRegion": { + "value": "global" + }, + "botEndpoint": { + "value": "" + }, + "appId": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json new file mode 100644 index 000000000..d199d5bba --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appServiceName": { + "value": "" + }, + "existingAppServicePlanName": { + "value": "" + }, + "existingAppServicePlanLocation": { + "value": "" + }, + "newAppServicePlanName": { + "value": "" + }, + "newAppServicePlanLocation": { + "value": "" + }, + "newAppServicePlanSku": { + "value": { + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", + "capacity": 1 + } + }, + "appId": { + "value": "" + }, + "appSecret": { + "value": "" + } + } +} diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md new file mode 100644 index 000000000..f0fbedbef --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md @@ -0,0 +1,28 @@ +Need deploy BotAppService before AzureBot +--- +az login +az deployment group create --resource-group --template-file --parameters @ +--- + +# parameters-for-template-BotApp-with-rg: + +**appServiceName**:(required) The Name of the Bot App Service. + +(choose an existingAppServicePlan or create a new AppServicePlan) +**existingAppServicePlanName**: The name of the App Service Plan. +**existingAppServicePlanLocation**: The location of the App Service Plan. +**newAppServicePlanName**: The name of the App Service Plan. +**newAppServicePlanLocation**: The location of the App Service Plan. +**newAppServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. +**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. + +# parameters-for-template-AzureBot-with-rg: + +**azureBotId**:(required) The globally unique and immutable bot ID. +**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**. +**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**. +**botEndpoint**: Use to handle client messages, Such as https://.azurewebsites.net/api/messages. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json new file mode 100644 index 000000000..f7d08b75d --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "azureBotId": { + "type": "string", + "metadata": { + "description": "The globally unique and immutable bot ID." + } + }, + "azureBotSku": { + "defaultValue": "S1", + "type": "string", + "metadata": { + "description": "The pricing tier of the Bot Service Registration. Allowed values are: F0, S1(default)." + } + }, + "azureBotRegion": { + "type": "string", + "defaultValue": "global", + "metadata": { + "description": "Specifies the location of the new AzureBot. Allowed values are: global(default), westeurope." + } + }, + "botEndpoint": { + "type": "string", + "metadata": { + "description": "Use to handle client messages, Such as https://.azurewebsites.net/api/messages." + } + }, + "appId": { + "type": "string", + "metadata": { + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." + } + } + }, + "resources": [ + { + "apiVersion": "2021-05-01-preview", + "type": "Microsoft.BotService/botServices", + "name": "[parameters('azureBotId')]", + "location": "[parameters('azureBotRegion')]", + "kind": "azurebot", + "sku": { + "name": "[parameters('azureBotSku')]" + }, + "properties": { + "name": "[parameters('azureBotId')]", + "displayName": "[parameters('azureBotId')]", + "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + "endpoint": "[parameters('botEndpoint')]", + "msaAppId": "[parameters('appId')]", + "luisAppIds": [], + "schemaTransformationVersion": "1.3", + "isCmekEnabled": false, + "isIsolated": false + } + } + ] +} \ No newline at end of file diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/template-with-preexisting-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json similarity index 66% rename from generators/generators/app/templates/empty/project/deploymentTemplates/template-with-preexisting-rg.json rename to generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json index d6feb0a0f..d606787a9 100644 --- a/generators/generators/app/templates/empty/project/deploymentTemplates/template-with-preexisting-rg.json +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json @@ -1,37 +1,37 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "appId": { + "appServiceName": { "type": "string", + "defaultValue": "", "metadata": { - "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings." + "description": "The globally unique name of the Web App." } }, - "appSecret": { + "existingAppServicePlanName": { "type": "string", + "defaultValue": "", "metadata": { - "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Defaults to \"\"." + "description": "Name of the existing App Service Plan used to create the Web App for the bot." } }, - "botId": { + "existingAppServicePlanLocation": { "type": "string", "metadata": { - "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable." + "description": "The location of the App Service Plan." } }, - "botSku": { - "defaultValue": "S1", + "newAppServicePlanName": { "type": "string", "metadata": { - "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + "description": "The name of the new App Service Plan." } }, - "newAppServicePlanName": { + "newAppServicePlanLocation": { "type": "string", - "defaultValue": "", "metadata": { - "description": "The name of the new App Service Plan." + "description": "The location of the App Service Plan." } }, "newAppServicePlanSku": { @@ -47,46 +47,34 @@ "description": "The SKU of the App Service Plan. Defaults to Standard values." } }, - "appServicePlanLocation": { - "type": "string", - "defaultValue": "", - "metadata": { - "description": "The location of the App Service Plan." - } - }, - "existingAppServicePlan": { + "appId": { "type": "string", - "defaultValue": "", "metadata": { - "description": "Name of the existing App Service Plan used to create the Web App for the bot." + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." } }, - "newWebAppName": { + "appSecret": { "type": "string", "defaultValue": "", "metadata": { - "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"." + "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types. Defaults to \"\"." } } }, "variables": { - "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlan')), 'createNewAppServicePlan', parameters('existingAppServicePlan'))]", - "useExistingAppServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]", - "servicePlanName": "[if(variables('useExistingAppServicePlan'), parameters('existingAppServicePlan'), parameters('newAppServicePlanName'))]", - "publishingUsername": "[concat('$', parameters('newWebAppName'))]", - "resourcesLocation": "[parameters('appServicePlanLocation')]", - "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlanName')), 'createNewAppServicePlan', parameters('existingAppServicePlanName'))]", + "useExistingServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]", + "servicePlanName": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanName'), parameters('newAppServicePlanName'))]", + "servicePlanLocation": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanLocation'), parameters('newAppServicePlanLocation'))]" }, "resources": [ { - "comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.", + "comments": "Create a new App Service Plan if no existing App Service Plan name was passed in.", "type": "Microsoft.Web/serverfarms", - "condition": "[not(variables('useExistingAppServicePlan'))]", + "condition": "[not(variables('useExistingServicePlan'))]", "name": "[variables('servicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('resourcesLocation')]", + "location": "[parameters('newAppServicePlanLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -101,25 +89,25 @@ } }, { - "comments": "Create a Web App using a Linux App Service Plan", + "comments": "Create a Web App using an App Service Plan", "type": "Microsoft.Web/sites", "apiVersion": "2018-11-01", - "location": "[variables('resourcesLocation')]", + "name": "[parameters('appServiceName')]", + "location": "[variables('servicePlanLocation')]", "kind": "app,linux", "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]" ], - "name": "[variables('webAppName')]", "properties": { - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "hostNameSslStates": [ { - "name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Standard" }, { - "name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.scm.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Repository" } @@ -163,10 +151,10 @@ { "type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", - "name": "[concat(variables('webAppName'), '/web')]", - "location": "[variables('resourcesLocation')]", + "name": "[concat(parameters('appServiceName'), '/web')]", + "location": "[variables('servicePlanLocation')]", "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]" ], "properties": { "numberOfWorkers": 1, @@ -188,7 +176,7 @@ "httpLoggingEnabled": false, "logsDirectorySizeLimit": 35, "detailedErrorLoggingEnabled": false, - "publishingUsername": "[variables('publishingUsername')]", + "publishingUsername": "[concat('$', parameters('appServiceName'))]", "scmType": "None", "use32BitWorkerProcess": true, "webSocketsEnabled": false, @@ -231,30 +219,6 @@ "ftpsState": "AllAllowed", "reservedInstanceCount": 0 } - }, - { - "apiVersion": "2021-03-01", - "type": "Microsoft.BotService/botServices", - "name": "[parameters('botId')]", - "location": "global", - "kind": "azurebot", - "sku": { - "name": "[parameters('botSku')]" - }, - "properties": { - "name": "[parameters('botId')]", - "displayName": "[parameters('botId')]", - "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", - "endpoint": "[variables('botEndpoint')]", - "msaAppId": "[parameters('appId')]", - "luisAppIds": [], - "schemaTransformationVersion": "1.3", - "isCmekEnabled": false, - "isIsolated": false - }, - "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" - ] } ] } diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json new file mode 100644 index 000000000..d459c8c53 --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "value": "" + }, + "groupLocation": { + "value": "" + }, + "azureBotId": { + "value": "" + }, + "azureBotSku": { + "value": "S1" + }, + "azureBotRegion": { + "value": "global" + }, + "botEndpoint": { + "value": "" + }, + "appId": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json new file mode 100644 index 000000000..765f70d79 --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "value": "" + }, + "groupLocation": { + "value": "" + }, + "appServiceName": { + "value": "" + }, + "appServicePlanName": { + "value": "" + }, + "appServicePlanLocation": { + "value": "" + }, + "appServicePlanSku": { + "value": { + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", + "capacity": 1 + } + }, + "appId": { + "value": "" + }, + "appSecret": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md new file mode 100644 index 000000000..652480123 --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md @@ -0,0 +1,31 @@ +Need deploy BotAppService before AzureBot +--- +az login +az deployment sub create --template-file --location --parameters @ +--- + +# parameters-for-template-BotApp-new-rg: + +**groupName**:(required) Specifies the name of the new Resource Group. +**groupLocation**:(required) Specifies the location of the new Resource Group. + +**appServiceName**:(required) The location of the App Service Plan. +**appServicePlanName**:(required) The name of the App Service Plan. +**appServicePlanLocation**: The location of the App Service Plan. Defaults to use groupLocation. +**appServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. +**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. + + +# parameters-for-template-AzureBot-new-rg: + +**groupName**:(required) Specifies the name of the new Resource Group. +**groupLocation**:(required) Specifies the location of the new Resource Group. + +**azureBotId**:(required) The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable. +**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**. +**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**. +**botEndpoint**: Use to handle client messages, Such as https://.azurewebsites.net/api/messages. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json new file mode 100644 index 000000000..3fd275b61 --- /dev/null +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json @@ -0,0 +1,101 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "type": "string", + "metadata": { + "description": "Specifies the name of the Resource Group." + } + }, + "groupLocation": { + "type": "string", + "metadata": { + "description": "Specifies the location of the Resource Group." + } + }, + "azureBotId": { + "type": "string", + "metadata": { + "description": "The globally unique and immutable bot ID." + } + }, + "azureBotSku": { + "type": "string", + "defaultValue": "S1", + "metadata": { + "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + } + }, + "azureBotRegion": { + "type": "string", + "defaultValue": "global", + "metadata": { + "description": "" + } + }, + "botEndpoint": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Use to handle client messages, Such as https://.azurewebsites.net/api/messages." + } + }, + "appId": { + "type": "string", + "metadata": { + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." + } + } + }, + "resources": [ + { + "name": "[parameters('groupName')]", + "type": "Microsoft.Resources/resourceGroups", + "apiVersion": "2018-05-01", + "location": "[parameters('groupLocation')]", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2018-05-01", + "name": "storageDeployment", + "resourceGroup": "[parameters('groupName')]", + "dependsOn": [ + "[resourceId('Microsoft.Resources/resourceGroups/', parameters('groupName'))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": {}, + "variables": {}, + "resources": [ + { + "apiVersion": "2021-03-01", + "type": "Microsoft.BotService/botServices", + "name": "[parameters('azureBotId')]", + "location": "[parameters('azureBotRegion')]", + "kind": "azurebot", + "sku": { + "name": "[parameters('azureBotSku')]" + }, + "properties": { + "name": "[parameters('azureBotId')]", + "displayName": "[parameters('azureBotId')]", + "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + "endpoint": "[parameters('botEndpoint')]", + "msaAppId": "[parameters('appId')]", + "luisAppIds": [], + "schemaTransformationVersion": "1.3", + "isCmekEnabled": false, + "isIsolated": false + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/template-with-new-rg.json b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json similarity index 72% rename from generators/generators/app/templates/core/project/deploymentTemplates/template-with-new-rg.json rename to generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json index 196cfb933..724792e17 100644 --- a/generators/generators/app/templates/core/project/deploymentTemplates/template-with-new-rg.json +++ b/generators/generators/app/templates/core/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json @@ -2,52 +2,37 @@ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "groupLocation": { - "defaultValue": "", - "type": "string", - "metadata": { - "description": "Specifies the location of the Resource Group." - } - }, "groupName": { "type": "string", "metadata": { "description": "Specifies the name of the Resource Group." } }, - "appId": { - "type": "string", - "metadata": { - "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings." - } - }, - "appSecret": { + "groupLocation": { "type": "string", "metadata": { - "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings." + "description": "Specifies the location of the Resource Group." } }, - "botId": { + "appServiceName": { "type": "string", "metadata": { - "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable." + "description": "The globally unique name of the Web App." } }, - "botSku": { - "defaultValue": "S1", + "appServicePlanName": { "type": "string", "metadata": { - "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + "description": "The name of the App Service Plan." } }, - "newAppServicePlanName": { - "defaultValue": "", + "appServicePlanLocation": { "type": "string", "metadata": { - "description": "The name of the App Service Plan." + "description": "The location of the App Service Plan." } }, - "newAppServicePlanSku": { + "appServicePlanSku": { "type": "object", "defaultValue": { "name": "P1v2", @@ -60,28 +45,21 @@ "description": "The SKU of the App Service Plan. Defaults to Standard values." } }, - "newAppServicePlanLocation": { - "defaultValue": "", + "appId": { "type": "string", "metadata": { - "description": "The location of the App Service Plan. Defaults to \"westus\"." + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." } }, - "newWebAppName": { + "appSecret": { "type": "string", - "defaultValue": "", "metadata": { - "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"." + "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types." } } }, "variables": { - "appServicePlanName": "[parameters('newAppServicePlanName')]", - "resourcesLocation": "[parameters('newAppServicePlanLocation')]", - "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", - "publishingUsername": "[concat('$', parameters('newWebAppName'))]", + "resourcesLocation": "[if(empty(parameters('appServicePlanLocation')), parameters('groupLocation'), parameters('appServicePlanLocation'))]", "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ @@ -109,15 +87,15 @@ "variables": {}, "resources": [ { - "comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.", + "comments": "Create a new App Service Plan", "type": "Microsoft.Web/serverfarms", - "name": "[variables('appServicePlanName')]", + "name": "[parameters('appServicePlanName')]", "apiVersion": "2018-02-01", "location": "[variables('resourcesLocation')]", - "sku": "[parameters('newAppServicePlanSku')]", + "sku": "[parameters('appServicePlanSku')]", "kind": "linux", "properties": { - "perSiteScaling": false, + "perSiteScaling": false, "maximumElasticWorkerCount": 1, "isSpot": false, "reserved": true, @@ -128,30 +106,30 @@ } }, { - "comments": "Create a Web App using a Linux App Service Plan", + "comments": "Create a Web App using the new App Service Plan", "type": "Microsoft.Web/sites", "apiVersion": "2018-11-01", "location": "[variables('resourcesLocation')]", "kind": "app,linux", "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]" ], - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "properties": { - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "hostNameSslStates": [ { - "name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Standard" }, { - "name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.scm.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Repository" } ], - "serverFarmId": "[variables('appServicePlanName')]", + "serverFarmId": "[parameters('appServicePlanName')]", "reserved": true, "isXenon": false, "hyperV": false, @@ -190,10 +168,10 @@ { "type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", - "name": "[concat(variables('webAppName'), '/web')]", + "name": "[concat(parameters('appServiceName'), '/web')]", "location": "[variables('resourcesLocation')]", "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', parameters('appServiceName'))]" ], "properties": { "numberOfWorkers": 1, @@ -215,7 +193,7 @@ "httpLoggingEnabled": false, "logsDirectorySizeLimit": 35, "detailedErrorLoggingEnabled": false, - "publishingUsername": "[variables('publishingUsername')]", + "publishingUsername": "[concat('$', parameters('appServiceName'))]", "scmType": "None", "use32BitWorkerProcess": true, "webSocketsEnabled": false, @@ -258,30 +236,6 @@ "ftpsState": "AllAllowed", "reservedInstanceCount": 0 } - }, - { - "apiVersion": "2021-03-01", - "type": "Microsoft.BotService/botServices", - "name": "[parameters('botId')]", - "location": "global", - "kind": "azurebot", - "sku": { - "name": "[parameters('botSku')]" - }, - "properties": { - "name": "[parameters('botId')]", - "displayName": "[parameters('botId')]", - "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", - "endpoint": "[variables('botEndpoint')]", - "msaAppId": "[parameters('appId')]", - "luisAppIds": [], - "schemaTransformationVersion": "1.3", - "isCmekEnabled": false, - "isIsolated": false - }, - "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" - ] } ], "outputs": {} diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json new file mode 100644 index 000000000..cc1800c0d --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "azureBotId": { + "value": "" + }, + "azureBotSku": { + "value": "S1" + }, + "azureBotRegion": { + "value": "global" + }, + "botEndpoint": { + "value": "" + }, + "appId": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json new file mode 100644 index 000000000..d199d5bba --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appServiceName": { + "value": "" + }, + "existingAppServicePlanName": { + "value": "" + }, + "existingAppServicePlanLocation": { + "value": "" + }, + "newAppServicePlanName": { + "value": "" + }, + "newAppServicePlanLocation": { + "value": "" + }, + "newAppServicePlanSku": { + "value": { + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", + "capacity": 1 + } + }, + "appId": { + "value": "" + }, + "appSecret": { + "value": "" + } + } +} diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md new file mode 100644 index 000000000..f0fbedbef --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md @@ -0,0 +1,28 @@ +Need deploy BotAppService before AzureBot +--- +az login +az deployment group create --resource-group --template-file --parameters @ +--- + +# parameters-for-template-BotApp-with-rg: + +**appServiceName**:(required) The Name of the Bot App Service. + +(choose an existingAppServicePlan or create a new AppServicePlan) +**existingAppServicePlanName**: The name of the App Service Plan. +**existingAppServicePlanLocation**: The location of the App Service Plan. +**newAppServicePlanName**: The name of the App Service Plan. +**newAppServicePlanLocation**: The location of the App Service Plan. +**newAppServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. +**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. + +# parameters-for-template-AzureBot-with-rg: + +**azureBotId**:(required) The globally unique and immutable bot ID. +**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**. +**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**. +**botEndpoint**: Use to handle client messages, Such as https://.azurewebsites.net/api/messages. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json new file mode 100644 index 000000000..f7d08b75d --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "azureBotId": { + "type": "string", + "metadata": { + "description": "The globally unique and immutable bot ID." + } + }, + "azureBotSku": { + "defaultValue": "S1", + "type": "string", + "metadata": { + "description": "The pricing tier of the Bot Service Registration. Allowed values are: F0, S1(default)." + } + }, + "azureBotRegion": { + "type": "string", + "defaultValue": "global", + "metadata": { + "description": "Specifies the location of the new AzureBot. Allowed values are: global(default), westeurope." + } + }, + "botEndpoint": { + "type": "string", + "metadata": { + "description": "Use to handle client messages, Such as https://.azurewebsites.net/api/messages." + } + }, + "appId": { + "type": "string", + "metadata": { + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." + } + } + }, + "resources": [ + { + "apiVersion": "2021-05-01-preview", + "type": "Microsoft.BotService/botServices", + "name": "[parameters('azureBotId')]", + "location": "[parameters('azureBotRegion')]", + "kind": "azurebot", + "sku": { + "name": "[parameters('azureBotSku')]" + }, + "properties": { + "name": "[parameters('azureBotId')]", + "displayName": "[parameters('azureBotId')]", + "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + "endpoint": "[parameters('botEndpoint')]", + "msaAppId": "[parameters('appId')]", + "luisAppIds": [], + "schemaTransformationVersion": "1.3", + "isCmekEnabled": false, + "isIsolated": false + } + } + ] +} \ No newline at end of file diff --git a/generators/generators/app/templates/core/project/deploymentTemplates/template-with-preexisting-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json similarity index 66% rename from generators/generators/app/templates/core/project/deploymentTemplates/template-with-preexisting-rg.json rename to generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json index d6feb0a0f..d606787a9 100644 --- a/generators/generators/app/templates/core/project/deploymentTemplates/template-with-preexisting-rg.json +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json @@ -1,37 +1,37 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "appId": { + "appServiceName": { "type": "string", + "defaultValue": "", "metadata": { - "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings." + "description": "The globally unique name of the Web App." } }, - "appSecret": { + "existingAppServicePlanName": { "type": "string", + "defaultValue": "", "metadata": { - "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Defaults to \"\"." + "description": "Name of the existing App Service Plan used to create the Web App for the bot." } }, - "botId": { + "existingAppServicePlanLocation": { "type": "string", "metadata": { - "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable." + "description": "The location of the App Service Plan." } }, - "botSku": { - "defaultValue": "S1", + "newAppServicePlanName": { "type": "string", "metadata": { - "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + "description": "The name of the new App Service Plan." } }, - "newAppServicePlanName": { + "newAppServicePlanLocation": { "type": "string", - "defaultValue": "", "metadata": { - "description": "The name of the new App Service Plan." + "description": "The location of the App Service Plan." } }, "newAppServicePlanSku": { @@ -47,46 +47,34 @@ "description": "The SKU of the App Service Plan. Defaults to Standard values." } }, - "appServicePlanLocation": { - "type": "string", - "defaultValue": "", - "metadata": { - "description": "The location of the App Service Plan." - } - }, - "existingAppServicePlan": { + "appId": { "type": "string", - "defaultValue": "", "metadata": { - "description": "Name of the existing App Service Plan used to create the Web App for the bot." + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." } }, - "newWebAppName": { + "appSecret": { "type": "string", "defaultValue": "", "metadata": { - "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"." + "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types. Defaults to \"\"." } } }, "variables": { - "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlan')), 'createNewAppServicePlan', parameters('existingAppServicePlan'))]", - "useExistingAppServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]", - "servicePlanName": "[if(variables('useExistingAppServicePlan'), parameters('existingAppServicePlan'), parameters('newAppServicePlanName'))]", - "publishingUsername": "[concat('$', parameters('newWebAppName'))]", - "resourcesLocation": "[parameters('appServicePlanLocation')]", - "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlanName')), 'createNewAppServicePlan', parameters('existingAppServicePlanName'))]", + "useExistingServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]", + "servicePlanName": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanName'), parameters('newAppServicePlanName'))]", + "servicePlanLocation": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanLocation'), parameters('newAppServicePlanLocation'))]" }, "resources": [ { - "comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.", + "comments": "Create a new App Service Plan if no existing App Service Plan name was passed in.", "type": "Microsoft.Web/serverfarms", - "condition": "[not(variables('useExistingAppServicePlan'))]", + "condition": "[not(variables('useExistingServicePlan'))]", "name": "[variables('servicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('resourcesLocation')]", + "location": "[parameters('newAppServicePlanLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -101,25 +89,25 @@ } }, { - "comments": "Create a Web App using a Linux App Service Plan", + "comments": "Create a Web App using an App Service Plan", "type": "Microsoft.Web/sites", "apiVersion": "2018-11-01", - "location": "[variables('resourcesLocation')]", + "name": "[parameters('appServiceName')]", + "location": "[variables('servicePlanLocation')]", "kind": "app,linux", "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]" ], - "name": "[variables('webAppName')]", "properties": { - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "hostNameSslStates": [ { - "name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Standard" }, { - "name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.scm.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Repository" } @@ -163,10 +151,10 @@ { "type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", - "name": "[concat(variables('webAppName'), '/web')]", - "location": "[variables('resourcesLocation')]", + "name": "[concat(parameters('appServiceName'), '/web')]", + "location": "[variables('servicePlanLocation')]", "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]" ], "properties": { "numberOfWorkers": 1, @@ -188,7 +176,7 @@ "httpLoggingEnabled": false, "logsDirectorySizeLimit": 35, "detailedErrorLoggingEnabled": false, - "publishingUsername": "[variables('publishingUsername')]", + "publishingUsername": "[concat('$', parameters('appServiceName'))]", "scmType": "None", "use32BitWorkerProcess": true, "webSocketsEnabled": false, @@ -231,30 +219,6 @@ "ftpsState": "AllAllowed", "reservedInstanceCount": 0 } - }, - { - "apiVersion": "2021-03-01", - "type": "Microsoft.BotService/botServices", - "name": "[parameters('botId')]", - "location": "global", - "kind": "azurebot", - "sku": { - "name": "[parameters('botSku')]" - }, - "properties": { - "name": "[parameters('botId')]", - "displayName": "[parameters('botId')]", - "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", - "endpoint": "[variables('botEndpoint')]", - "msaAppId": "[parameters('appId')]", - "luisAppIds": [], - "schemaTransformationVersion": "1.3", - "isCmekEnabled": false, - "isIsolated": false - }, - "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" - ] } ] } diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json new file mode 100644 index 000000000..d459c8c53 --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "value": "" + }, + "groupLocation": { + "value": "" + }, + "azureBotId": { + "value": "" + }, + "azureBotSku": { + "value": "S1" + }, + "azureBotRegion": { + "value": "global" + }, + "botEndpoint": { + "value": "" + }, + "appId": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json new file mode 100644 index 000000000..765f70d79 --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "value": "" + }, + "groupLocation": { + "value": "" + }, + "appServiceName": { + "value": "" + }, + "appServicePlanName": { + "value": "" + }, + "appServicePlanLocation": { + "value": "" + }, + "appServicePlanSku": { + "value": { + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", + "capacity": 1 + } + }, + "appId": { + "value": "" + }, + "appSecret": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md new file mode 100644 index 000000000..652480123 --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md @@ -0,0 +1,31 @@ +Need deploy BotAppService before AzureBot +--- +az login +az deployment sub create --template-file --location --parameters @ +--- + +# parameters-for-template-BotApp-new-rg: + +**groupName**:(required) Specifies the name of the new Resource Group. +**groupLocation**:(required) Specifies the location of the new Resource Group. + +**appServiceName**:(required) The location of the App Service Plan. +**appServicePlanName**:(required) The name of the App Service Plan. +**appServicePlanLocation**: The location of the App Service Plan. Defaults to use groupLocation. +**appServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. +**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. + + +# parameters-for-template-AzureBot-new-rg: + +**groupName**:(required) Specifies the name of the new Resource Group. +**groupLocation**:(required) Specifies the location of the new Resource Group. + +**azureBotId**:(required) The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable. +**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**. +**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**. +**botEndpoint**: Use to handle client messages, Such as https://.azurewebsites.net/api/messages. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json new file mode 100644 index 000000000..3fd275b61 --- /dev/null +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json @@ -0,0 +1,101 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "type": "string", + "metadata": { + "description": "Specifies the name of the Resource Group." + } + }, + "groupLocation": { + "type": "string", + "metadata": { + "description": "Specifies the location of the Resource Group." + } + }, + "azureBotId": { + "type": "string", + "metadata": { + "description": "The globally unique and immutable bot ID." + } + }, + "azureBotSku": { + "type": "string", + "defaultValue": "S1", + "metadata": { + "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + } + }, + "azureBotRegion": { + "type": "string", + "defaultValue": "global", + "metadata": { + "description": "" + } + }, + "botEndpoint": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Use to handle client messages, Such as https://.azurewebsites.net/api/messages." + } + }, + "appId": { + "type": "string", + "metadata": { + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." + } + } + }, + "resources": [ + { + "name": "[parameters('groupName')]", + "type": "Microsoft.Resources/resourceGroups", + "apiVersion": "2018-05-01", + "location": "[parameters('groupLocation')]", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2018-05-01", + "name": "storageDeployment", + "resourceGroup": "[parameters('groupName')]", + "dependsOn": [ + "[resourceId('Microsoft.Resources/resourceGroups/', parameters('groupName'))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": {}, + "variables": {}, + "resources": [ + { + "apiVersion": "2021-03-01", + "type": "Microsoft.BotService/botServices", + "name": "[parameters('azureBotId')]", + "location": "[parameters('azureBotRegion')]", + "kind": "azurebot", + "sku": { + "name": "[parameters('azureBotSku')]" + }, + "properties": { + "name": "[parameters('azureBotId')]", + "displayName": "[parameters('azureBotId')]", + "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + "endpoint": "[parameters('botEndpoint')]", + "msaAppId": "[parameters('appId')]", + "luisAppIds": [], + "schemaTransformationVersion": "1.3", + "isCmekEnabled": false, + "isIsolated": false + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/template-with-new-rg.json b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json similarity index 72% rename from generators/generators/app/templates/empty/project/deploymentTemplates/template-with-new-rg.json rename to generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json index 196cfb933..724792e17 100644 --- a/generators/generators/app/templates/empty/project/deploymentTemplates/template-with-new-rg.json +++ b/generators/generators/app/templates/echo/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json @@ -2,52 +2,37 @@ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "groupLocation": { - "defaultValue": "", - "type": "string", - "metadata": { - "description": "Specifies the location of the Resource Group." - } - }, "groupName": { "type": "string", "metadata": { "description": "Specifies the name of the Resource Group." } }, - "appId": { - "type": "string", - "metadata": { - "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings." - } - }, - "appSecret": { + "groupLocation": { "type": "string", "metadata": { - "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings." + "description": "Specifies the location of the Resource Group." } }, - "botId": { + "appServiceName": { "type": "string", "metadata": { - "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable." + "description": "The globally unique name of the Web App." } }, - "botSku": { - "defaultValue": "S1", + "appServicePlanName": { "type": "string", "metadata": { - "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + "description": "The name of the App Service Plan." } }, - "newAppServicePlanName": { - "defaultValue": "", + "appServicePlanLocation": { "type": "string", "metadata": { - "description": "The name of the App Service Plan." + "description": "The location of the App Service Plan." } }, - "newAppServicePlanSku": { + "appServicePlanSku": { "type": "object", "defaultValue": { "name": "P1v2", @@ -60,28 +45,21 @@ "description": "The SKU of the App Service Plan. Defaults to Standard values." } }, - "newAppServicePlanLocation": { - "defaultValue": "", + "appId": { "type": "string", "metadata": { - "description": "The location of the App Service Plan. Defaults to \"westus\"." + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." } }, - "newWebAppName": { + "appSecret": { "type": "string", - "defaultValue": "", "metadata": { - "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"." + "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types." } } }, "variables": { - "appServicePlanName": "[parameters('newAppServicePlanName')]", - "resourcesLocation": "[parameters('newAppServicePlanLocation')]", - "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", - "publishingUsername": "[concat('$', parameters('newWebAppName'))]", + "resourcesLocation": "[if(empty(parameters('appServicePlanLocation')), parameters('groupLocation'), parameters('appServicePlanLocation'))]", "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ @@ -109,15 +87,15 @@ "variables": {}, "resources": [ { - "comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.", + "comments": "Create a new App Service Plan", "type": "Microsoft.Web/serverfarms", - "name": "[variables('appServicePlanName')]", + "name": "[parameters('appServicePlanName')]", "apiVersion": "2018-02-01", "location": "[variables('resourcesLocation')]", - "sku": "[parameters('newAppServicePlanSku')]", + "sku": "[parameters('appServicePlanSku')]", "kind": "linux", "properties": { - "perSiteScaling": false, + "perSiteScaling": false, "maximumElasticWorkerCount": 1, "isSpot": false, "reserved": true, @@ -128,30 +106,30 @@ } }, { - "comments": "Create a Web App using a Linux App Service Plan", + "comments": "Create a Web App using the new App Service Plan", "type": "Microsoft.Web/sites", "apiVersion": "2018-11-01", "location": "[variables('resourcesLocation')]", "kind": "app,linux", "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]" ], - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "properties": { - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "hostNameSslStates": [ { - "name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Standard" }, { - "name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.scm.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Repository" } ], - "serverFarmId": "[variables('appServicePlanName')]", + "serverFarmId": "[parameters('appServicePlanName')]", "reserved": true, "isXenon": false, "hyperV": false, @@ -190,10 +168,10 @@ { "type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", - "name": "[concat(variables('webAppName'), '/web')]", + "name": "[concat(parameters('appServiceName'), '/web')]", "location": "[variables('resourcesLocation')]", "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', parameters('appServiceName'))]" ], "properties": { "numberOfWorkers": 1, @@ -215,7 +193,7 @@ "httpLoggingEnabled": false, "logsDirectorySizeLimit": 35, "detailedErrorLoggingEnabled": false, - "publishingUsername": "[variables('publishingUsername')]", + "publishingUsername": "[concat('$', parameters('appServiceName'))]", "scmType": "None", "use32BitWorkerProcess": true, "webSocketsEnabled": false, @@ -258,30 +236,6 @@ "ftpsState": "AllAllowed", "reservedInstanceCount": 0 } - }, - { - "apiVersion": "2021-03-01", - "type": "Microsoft.BotService/botServices", - "name": "[parameters('botId')]", - "location": "global", - "kind": "azurebot", - "sku": { - "name": "[parameters('botSku')]" - }, - "properties": { - "name": "[parameters('botId')]", - "displayName": "[parameters('botId')]", - "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", - "endpoint": "[variables('botEndpoint')]", - "msaAppId": "[parameters('appId')]", - "luisAppIds": [], - "schemaTransformationVersion": "1.3", - "isCmekEnabled": false, - "isIsolated": false - }, - "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" - ] } ], "outputs": {} diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json new file mode 100644 index 000000000..cc1800c0d --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "azureBotId": { + "value": "" + }, + "azureBotSku": { + "value": "S1" + }, + "azureBotRegion": { + "value": "global" + }, + "botEndpoint": { + "value": "" + }, + "appId": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json new file mode 100644 index 000000000..d199d5bba --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appServiceName": { + "value": "" + }, + "existingAppServicePlanName": { + "value": "" + }, + "existingAppServicePlanLocation": { + "value": "" + }, + "newAppServicePlanName": { + "value": "" + }, + "newAppServicePlanLocation": { + "value": "" + }, + "newAppServicePlanSku": { + "value": { + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", + "capacity": 1 + } + }, + "appId": { + "value": "" + }, + "appSecret": { + "value": "" + } + } +} diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md new file mode 100644 index 000000000..f0fbedbef --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/readme.md @@ -0,0 +1,28 @@ +Need deploy BotAppService before AzureBot +--- +az login +az deployment group create --resource-group --template-file --parameters @ +--- + +# parameters-for-template-BotApp-with-rg: + +**appServiceName**:(required) The Name of the Bot App Service. + +(choose an existingAppServicePlan or create a new AppServicePlan) +**existingAppServicePlanName**: The name of the App Service Plan. +**existingAppServicePlanLocation**: The location of the App Service Plan. +**newAppServicePlanName**: The name of the App Service Plan. +**newAppServicePlanLocation**: The location of the App Service Plan. +**newAppServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. +**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. + +# parameters-for-template-AzureBot-with-rg: + +**azureBotId**:(required) The globally unique and immutable bot ID. +**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**. +**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**. +**botEndpoint**: Use to handle client messages, Such as https://.azurewebsites.net/api/messages. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json new file mode 100644 index 000000000..f7d08b75d --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/template-AzureBot-with-rg.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "azureBotId": { + "type": "string", + "metadata": { + "description": "The globally unique and immutable bot ID." + } + }, + "azureBotSku": { + "defaultValue": "S1", + "type": "string", + "metadata": { + "description": "The pricing tier of the Bot Service Registration. Allowed values are: F0, S1(default)." + } + }, + "azureBotRegion": { + "type": "string", + "defaultValue": "global", + "metadata": { + "description": "Specifies the location of the new AzureBot. Allowed values are: global(default), westeurope." + } + }, + "botEndpoint": { + "type": "string", + "metadata": { + "description": "Use to handle client messages, Such as https://.azurewebsites.net/api/messages." + } + }, + "appId": { + "type": "string", + "metadata": { + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." + } + } + }, + "resources": [ + { + "apiVersion": "2021-05-01-preview", + "type": "Microsoft.BotService/botServices", + "name": "[parameters('azureBotId')]", + "location": "[parameters('azureBotRegion')]", + "kind": "azurebot", + "sku": { + "name": "[parameters('azureBotSku')]" + }, + "properties": { + "name": "[parameters('azureBotId')]", + "displayName": "[parameters('azureBotId')]", + "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + "endpoint": "[parameters('botEndpoint')]", + "msaAppId": "[parameters('appId')]", + "luisAppIds": [], + "schemaTransformationVersion": "1.3", + "isCmekEnabled": false, + "isIsolated": false + } + } + ] +} \ No newline at end of file diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/template-with-preexisting-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json similarity index 66% rename from generators/generators/app/templates/echo/project/deploymentTemplates/template-with-preexisting-rg.json rename to generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json index d6feb0a0f..d606787a9 100644 --- a/generators/generators/app/templates/echo/project/deploymentTemplates/template-with-preexisting-rg.json +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployUseExistResourceGroup/template-BotApp-with-rg.json @@ -1,37 +1,37 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "appId": { + "appServiceName": { "type": "string", + "defaultValue": "", "metadata": { - "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings." + "description": "The globally unique name of the Web App." } }, - "appSecret": { + "existingAppServicePlanName": { "type": "string", + "defaultValue": "", "metadata": { - "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Defaults to \"\"." + "description": "Name of the existing App Service Plan used to create the Web App for the bot." } }, - "botId": { + "existingAppServicePlanLocation": { "type": "string", "metadata": { - "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable." + "description": "The location of the App Service Plan." } }, - "botSku": { - "defaultValue": "S1", + "newAppServicePlanName": { "type": "string", "metadata": { - "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + "description": "The name of the new App Service Plan." } }, - "newAppServicePlanName": { + "newAppServicePlanLocation": { "type": "string", - "defaultValue": "", "metadata": { - "description": "The name of the new App Service Plan." + "description": "The location of the App Service Plan." } }, "newAppServicePlanSku": { @@ -47,46 +47,34 @@ "description": "The SKU of the App Service Plan. Defaults to Standard values." } }, - "appServicePlanLocation": { - "type": "string", - "defaultValue": "", - "metadata": { - "description": "The location of the App Service Plan." - } - }, - "existingAppServicePlan": { + "appId": { "type": "string", - "defaultValue": "", "metadata": { - "description": "Name of the existing App Service Plan used to create the Web App for the bot." + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." } }, - "newWebAppName": { + "appSecret": { "type": "string", "defaultValue": "", "metadata": { - "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"." + "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types. Defaults to \"\"." } } }, "variables": { - "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlan')), 'createNewAppServicePlan', parameters('existingAppServicePlan'))]", - "useExistingAppServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]", - "servicePlanName": "[if(variables('useExistingAppServicePlan'), parameters('existingAppServicePlan'), parameters('newAppServicePlanName'))]", - "publishingUsername": "[concat('$', parameters('newWebAppName'))]", - "resourcesLocation": "[parameters('appServicePlanLocation')]", - "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]" + "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlanName')), 'createNewAppServicePlan', parameters('existingAppServicePlanName'))]", + "useExistingServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]", + "servicePlanName": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanName'), parameters('newAppServicePlanName'))]", + "servicePlanLocation": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanLocation'), parameters('newAppServicePlanLocation'))]" }, "resources": [ { - "comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.", + "comments": "Create a new App Service Plan if no existing App Service Plan name was passed in.", "type": "Microsoft.Web/serverfarms", - "condition": "[not(variables('useExistingAppServicePlan'))]", + "condition": "[not(variables('useExistingServicePlan'))]", "name": "[variables('servicePlanName')]", "apiVersion": "2018-02-01", - "location": "[variables('resourcesLocation')]", + "location": "[parameters('newAppServicePlanLocation')]", "sku": "[parameters('newAppServicePlanSku')]", "kind": "linux", "properties": { @@ -101,25 +89,25 @@ } }, { - "comments": "Create a Web App using a Linux App Service Plan", + "comments": "Create a Web App using an App Service Plan", "type": "Microsoft.Web/sites", "apiVersion": "2018-11-01", - "location": "[variables('resourcesLocation')]", + "name": "[parameters('appServiceName')]", + "location": "[variables('servicePlanLocation')]", "kind": "app,linux", "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]" ], - "name": "[variables('webAppName')]", "properties": { - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "hostNameSslStates": [ { - "name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Standard" }, { - "name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.scm.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Repository" } @@ -163,10 +151,10 @@ { "type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", - "name": "[concat(variables('webAppName'), '/web')]", - "location": "[variables('resourcesLocation')]", + "name": "[concat(parameters('appServiceName'), '/web')]", + "location": "[variables('servicePlanLocation')]", "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" + "[resourceId('Microsoft.Web/sites', parameters('appServiceName'))]" ], "properties": { "numberOfWorkers": 1, @@ -188,7 +176,7 @@ "httpLoggingEnabled": false, "logsDirectorySizeLimit": 35, "detailedErrorLoggingEnabled": false, - "publishingUsername": "[variables('publishingUsername')]", + "publishingUsername": "[concat('$', parameters('appServiceName'))]", "scmType": "None", "use32BitWorkerProcess": true, "webSocketsEnabled": false, @@ -231,30 +219,6 @@ "ftpsState": "AllAllowed", "reservedInstanceCount": 0 } - }, - { - "apiVersion": "2021-03-01", - "type": "Microsoft.BotService/botServices", - "name": "[parameters('botId')]", - "location": "global", - "kind": "azurebot", - "sku": { - "name": "[parameters('botSku')]" - }, - "properties": { - "name": "[parameters('botId')]", - "displayName": "[parameters('botId')]", - "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", - "endpoint": "[variables('botEndpoint')]", - "msaAppId": "[parameters('appId')]", - "luisAppIds": [], - "schemaTransformationVersion": "1.3", - "isCmekEnabled": false, - "isIsolated": false - }, - "dependsOn": [ - "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]" - ] } ] } diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json new file mode 100644 index 000000000..d459c8c53 --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-AzureBot-new-rg.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "value": "" + }, + "groupLocation": { + "value": "" + }, + "azureBotId": { + "value": "" + }, + "azureBotSku": { + "value": "S1" + }, + "azureBotRegion": { + "value": "global" + }, + "botEndpoint": { + "value": "" + }, + "appId": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json new file mode 100644 index 000000000..765f70d79 --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/parameters-for-template-BotApp-new-rg.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "value": "" + }, + "groupLocation": { + "value": "" + }, + "appServiceName": { + "value": "" + }, + "appServicePlanName": { + "value": "" + }, + "appServicePlanLocation": { + "value": "" + }, + "appServicePlanSku": { + "value": { + "name": "P1v2", + "tier": "PremiumV2", + "size": "P1v2", + "family": "Pv2", + "capacity": 1 + } + }, + "appId": { + "value": "" + }, + "appSecret": { + "value": "" + } + } +} \ No newline at end of file diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md new file mode 100644 index 000000000..652480123 --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/readme.md @@ -0,0 +1,31 @@ +Need deploy BotAppService before AzureBot +--- +az login +az deployment sub create --template-file --location --parameters @ +--- + +# parameters-for-template-BotApp-new-rg: + +**groupName**:(required) Specifies the name of the new Resource Group. +**groupLocation**:(required) Specifies the location of the new Resource Group. + +**appServiceName**:(required) The location of the App Service Plan. +**appServicePlanName**:(required) The name of the App Service Plan. +**appServicePlanLocation**: The location of the App Service Plan. Defaults to use groupLocation. +**appServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. +**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. + + +# parameters-for-template-AzureBot-new-rg: + +**groupName**:(required) Specifies the name of the new Resource Group. +**groupLocation**:(required) Specifies the location of the new Resource Group. + +**azureBotId**:(required) The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable. +**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**. +**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**. +**botEndpoint**: Use to handle client messages, Such as https://.azurewebsites.net/api/messages. + +**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings. diff --git a/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json new file mode 100644 index 000000000..3fd275b61 --- /dev/null +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/template-AzureBot-new-rg.json @@ -0,0 +1,101 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "groupName": { + "type": "string", + "metadata": { + "description": "Specifies the name of the Resource Group." + } + }, + "groupLocation": { + "type": "string", + "metadata": { + "description": "Specifies the location of the Resource Group." + } + }, + "azureBotId": { + "type": "string", + "metadata": { + "description": "The globally unique and immutable bot ID." + } + }, + "azureBotSku": { + "type": "string", + "defaultValue": "S1", + "metadata": { + "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + } + }, + "azureBotRegion": { + "type": "string", + "defaultValue": "global", + "metadata": { + "description": "" + } + }, + "botEndpoint": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "Use to handle client messages, Such as https://.azurewebsites.net/api/messages." + } + }, + "appId": { + "type": "string", + "metadata": { + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." + } + } + }, + "resources": [ + { + "name": "[parameters('groupName')]", + "type": "Microsoft.Resources/resourceGroups", + "apiVersion": "2018-05-01", + "location": "[parameters('groupLocation')]", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2018-05-01", + "name": "storageDeployment", + "resourceGroup": "[parameters('groupName')]", + "dependsOn": [ + "[resourceId('Microsoft.Resources/resourceGroups/', parameters('groupName'))]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": {}, + "variables": {}, + "resources": [ + { + "apiVersion": "2021-03-01", + "type": "Microsoft.BotService/botServices", + "name": "[parameters('azureBotId')]", + "location": "[parameters('azureBotRegion')]", + "kind": "azurebot", + "sku": { + "name": "[parameters('azureBotSku')]" + }, + "properties": { + "name": "[parameters('azureBotId')]", + "displayName": "[parameters('azureBotId')]", + "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", + "endpoint": "[parameters('botEndpoint')]", + "msaAppId": "[parameters('appId')]", + "luisAppIds": [], + "schemaTransformationVersion": "1.3", + "isCmekEnabled": false, + "isIsolated": false + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/generators/generators/app/templates/echo/project/deploymentTemplates/template-with-new-rg.json b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json similarity index 72% rename from generators/generators/app/templates/echo/project/deploymentTemplates/template-with-new-rg.json rename to generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json index 196cfb933..724792e17 100644 --- a/generators/generators/app/templates/echo/project/deploymentTemplates/template-with-new-rg.json +++ b/generators/generators/app/templates/empty/project/deploymentTemplates/DeployWithNewResourceGroup/template-BotApp-new-rg.json @@ -2,52 +2,37 @@ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { - "groupLocation": { - "defaultValue": "", - "type": "string", - "metadata": { - "description": "Specifies the location of the Resource Group." - } - }, "groupName": { "type": "string", "metadata": { "description": "Specifies the name of the Resource Group." } }, - "appId": { - "type": "string", - "metadata": { - "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings." - } - }, - "appSecret": { + "groupLocation": { "type": "string", "metadata": { - "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings." + "description": "Specifies the location of the Resource Group." } }, - "botId": { + "appServiceName": { "type": "string", "metadata": { - "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable." + "description": "The globally unique name of the Web App." } }, - "botSku": { - "defaultValue": "S1", + "appServicePlanName": { "type": "string", "metadata": { - "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1." + "description": "The name of the App Service Plan." } }, - "newAppServicePlanName": { - "defaultValue": "", + "appServicePlanLocation": { "type": "string", "metadata": { - "description": "The name of the App Service Plan." + "description": "The location of the App Service Plan." } }, - "newAppServicePlanSku": { + "appServicePlanSku": { "type": "object", "defaultValue": { "name": "P1v2", @@ -60,28 +45,21 @@ "description": "The SKU of the App Service Plan. Defaults to Standard values." } }, - "newAppServicePlanLocation": { - "defaultValue": "", + "appId": { "type": "string", "metadata": { - "description": "The location of the App Service Plan. Defaults to \"westus\"." + "description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings." } }, - "newWebAppName": { + "appSecret": { "type": "string", - "defaultValue": "", "metadata": { - "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"." + "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types." } } }, "variables": { - "appServicePlanName": "[parameters('newAppServicePlanName')]", - "resourcesLocation": "[parameters('newAppServicePlanLocation')]", - "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]", - "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]", - "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]", - "publishingUsername": "[concat('$', parameters('newWebAppName'))]", + "resourcesLocation": "[if(empty(parameters('appServicePlanLocation')), parameters('groupLocation'), parameters('appServicePlanLocation'))]", "resourceGroupId": "[concat(subscription().id, '/resourceGroups/', parameters('groupName'))]" }, "resources": [ @@ -109,15 +87,15 @@ "variables": {}, "resources": [ { - "comments": "Create a new Linux App Service Plan if no existing App Service Plan name was passed in.", + "comments": "Create a new App Service Plan", "type": "Microsoft.Web/serverfarms", - "name": "[variables('appServicePlanName')]", + "name": "[parameters('appServicePlanName')]", "apiVersion": "2018-02-01", "location": "[variables('resourcesLocation')]", - "sku": "[parameters('newAppServicePlanSku')]", + "sku": "[parameters('appServicePlanSku')]", "kind": "linux", "properties": { - "perSiteScaling": false, + "perSiteScaling": false, "maximumElasticWorkerCount": 1, "isSpot": false, "reserved": true, @@ -128,30 +106,30 @@ } }, { - "comments": "Create a Web App using a Linux App Service Plan", + "comments": "Create a Web App using the new App Service Plan", "type": "Microsoft.Web/sites", "apiVersion": "2018-11-01", "location": "[variables('resourcesLocation')]", "kind": "app,linux", "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]" ], - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "properties": { - "name": "[variables('webAppName')]", + "name": "[parameters('appServiceName')]", "hostNameSslStates": [ { - "name": "[concat(parameters('newWebAppName'), '.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Standard" }, { - "name": "[concat(parameters('newWebAppName'), '.scm.azurewebsites.net')]", + "name": "[concat(parameters('appServiceName'), '.scm.azurewebsites.net')]", "sslState": "Disabled", "hostType": "Repository" } ], - "serverFarmId": "[variables('appServicePlanName')]", + "serverFarmId": "[parameters('appServicePlanName')]", "reserved": true, "isXenon": false, "hyperV": false, @@ -190,10 +168,10 @@ { "type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", - "name": "[concat(variables('webAppName'), '/web')]", + "name": "[concat(parameters('appServiceName'), '/web')]", "location": "[variables('resourcesLocation')]", "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" + "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', parameters('appServiceName'))]" ], "properties": { "numberOfWorkers": 1, @@ -215,7 +193,7 @@ "httpLoggingEnabled": false, "logsDirectorySizeLimit": 35, "detailedErrorLoggingEnabled": false, - "publishingUsername": "[variables('publishingUsername')]", + "publishingUsername": "[concat('$', parameters('appServiceName'))]", "scmType": "None", "use32BitWorkerProcess": true, "webSocketsEnabled": false, @@ -258,30 +236,6 @@ "ftpsState": "AllAllowed", "reservedInstanceCount": 0 } - }, - { - "apiVersion": "2021-03-01", - "type": "Microsoft.BotService/botServices", - "name": "[parameters('botId')]", - "location": "global", - "kind": "azurebot", - "sku": { - "name": "[parameters('botSku')]" - }, - "properties": { - "name": "[parameters('botId')]", - "displayName": "[parameters('botId')]", - "iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png", - "endpoint": "[variables('botEndpoint')]", - "msaAppId": "[parameters('appId')]", - "luisAppIds": [], - "schemaTransformationVersion": "1.3", - "isCmekEnabled": false, - "isIsolated": false - }, - "dependsOn": [ - "[concat(variables('resourceGroupId'), '/providers/Microsoft.Web/sites/', variables('webAppName'))]" - ] } ], "outputs": {}