Skip to content

Commit 3a55f8a

Browse files
authored
Added missing parameters: appType, UMSIName, UMSIResourceGroupName, and tenantId to the ARM template for Python bot deployment. (#2191)
1 parent 62d7366 commit 3a55f8a

30 files changed

+1115
-164
lines changed

generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/parameters-for-template-AzureBot-with-rg.json

+12
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@
1414
"botEndpoint": {
1515
"value": ""
1616
},
17+
"appType": {
18+
"value": "MultiTenant"
19+
},
1720
"appId": {
1821
"value": ""
22+
},
23+
"UMSIName": {
24+
"value": ""
25+
},
26+
"UMSIResourceGroupName": {
27+
"value": ""
28+
},
29+
"tenantId": {
30+
"value": ""
1931
}
2032
}
2133
}

generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/parameters-for-template-BotApp-with-rg.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"value": ""
1616
},
1717
"newAppServicePlanLocation": {
18-
"value": ""
18+
"value": "West US"
1919
},
2020
"newAppServicePlanSku": {
2121
"value": {
@@ -26,11 +26,23 @@
2626
"capacity": 1
2727
}
2828
},
29+
"appType": {
30+
"value": "MultiTenant"
31+
},
2932
"appId": {
3033
"value": ""
3134
},
3235
"appSecret": {
3336
"value": ""
37+
},
38+
"tenantId": {
39+
"value": ""
40+
},
41+
"UMSIName": {
42+
"value": ""
43+
},
44+
"UMSIResourceGroupName": {
45+
"value": ""
3446
}
3547
}
3648
}
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
1-
Need deploy BotAppService before AzureBot
2-
---
3-
az login
4-
az deployment group create --resource-group <group-name> --template-file <template-file> --parameters @<parameters-file>
5-
---
1+
# Usage
2+
BotApp must be deployed prior to AzureBot.
3+
4+
### Command line:
5+
`az login`<br>
6+
`az deployment group create --resource-group <group-name> --template-file <template-file> --parameters @<parameters-file>`
67

78
# parameters-for-template-BotApp-with-rg:
89

9-
**appServiceName**:(required) The Name of the Bot App Service.
10+
- **appServiceName**:(required) The Name of the Bot App Service.
11+
12+
- (choose an existingAppServicePlan or create a new AppServicePlan)
13+
- **existingAppServicePlanName**: The name of the App Service Plan.
14+
- **existingAppServicePlanLocation**: The location of the App Service Plan.
15+
- **newAppServicePlanName**: The name of the App Service Plan.
16+
- **newAppServicePlanLocation**: The location of the App Service Plan.
17+
- **newAppServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values.
18+
19+
- **appType**: Type of Bot Authentication. set as MicrosoftAppType in the Web App's Application Settings. **Allowed values are: MultiTenant(default), SingleTenant, UserAssignedMSI.**
20+
21+
- **appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings.
22+
23+
- **appSecret**:(required for MultiTenant and SingleTenant) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings.
24+
25+
- **UMSIName**:(required for UserAssignedMSI) The User-Assigned Managed Identity Resource used for the Bot's Authentication.
26+
27+
- **UMSIResourceGroupName**:(required for UserAssignedMSI) The User-Assigned Managed Identity Resource Group used for the Bot's Authentication.
28+
29+
- **tenantId**: The Azure AD Tenant ID to use as part of the Bot's Authentication. Only used for SingleTenant and UserAssignedMSI app types. Defaults to <Subscription Tenant ID>.
30+
31+
MoreInfo: https://docs.microsoft.com/en-us/azure/bot-service/tutorial-provision-a-bot?view=azure-bot-service-4.0&tabs=userassigned%2Cnewgroup#create-an-identity-resource
1032

11-
(choose an existingAppServicePlan or create a new AppServicePlan)
12-
**existingAppServicePlanName**: The name of the App Service Plan.
13-
**existingAppServicePlanLocation**: The location of the App Service Plan.
14-
**newAppServicePlanName**: The name of the App Service Plan.
15-
**newAppServicePlanLocation**: The location of the App Service Plan.
16-
**newAppServicePlanSku**: The SKU of the App Service Plan. Defaults to Standard values.
1733

18-
**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings.
19-
**appSecret**:(required) Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings.
2034

2135
# parameters-for-template-AzureBot-with-rg:
2236

23-
**azureBotId**:(required) The globally unique and immutable bot ID.
24-
**azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**.
25-
**azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**.
26-
**botEndpoint**: Use to handle client messages, Such as https://<botappServiceName>.azurewebsites.net/api/messages.
37+
- **azureBotId**:(required) The globally unique and immutable bot ID.
38+
- **azureBotSku**: The pricing tier of the Bot Service Registration. **Allowed values are: F0, S1(default)**.
39+
- **azureBotRegion**: Specifies the location of the new AzureBot. **Allowed values are: global(default), westeurope**.
40+
- **botEndpoint**: Use to handle client messages, Such as https://<botappServiceName>.azurewebsites.net/api/messages.
41+
42+
- **appType**: Type of Bot Authentication. set as MicrosoftAppType in the Web App's Application Settings. **Allowed values are: MultiTenant(default), SingleTenant, UserAssignedMSI.**
43+
- **appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings.
44+
- **UMSIName**:(required for UserAssignedMSI) The User-Assigned Managed Identity Resource used for the Bot's Authentication.
45+
- **UMSIResourceGroupName**:(required for UserAssignedMSI) The User-Assigned Managed Identity Resource Group used for the Bot's Authentication.
46+
- **tenantId**: The Azure AD Tenant ID to use as part of the Bot's Authentication. Only used for SingleTenant and UserAssignedMSI app types. Defaults to <Subscription Tenant ID>.
2747

28-
**appId**:(required) Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings.
48+
MoreInfo: https://docs.microsoft.com/en-us/azure/bot-service/tutorial-provision-a-bot?view=azure-bot-service-4.0&tabs=userassigned%2Cnewgroup#create-an-identity-resource

generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/template-AzureBot-with-rg.json

+62-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
}
1010
},
1111
"azureBotSku": {
12-
"defaultValue": "S1",
1312
"type": "string",
13+
"defaultValue": "S1",
1414
"metadata": {
1515
"description": "The pricing tier of the Bot Service Registration. Allowed values are: F0, S1(default)."
1616
}
@@ -24,15 +24,72 @@
2424
},
2525
"botEndpoint": {
2626
"type": "string",
27+
"defaultValue": "",
2728
"metadata": {
2829
"description": "Use to handle client messages, Such as https://<botappServiceName>.azurewebsites.net/api/messages."
2930
}
3031
},
32+
"appType": {
33+
"type": "string",
34+
"defaultValue": "MultiTenant",
35+
"allowedValues": [
36+
"MultiTenant",
37+
"SingleTenant",
38+
"UserAssignedMSI"
39+
],
40+
"metadata": {
41+
"description": "Type of Bot Authentication. set as MicrosoftAppType in the Web App's Application Settings. Allowed values are: MultiTenant, SingleTenant, UserAssignedMSI. Defaults to \"MultiTenant\"."
42+
}
43+
},
3144
"appId": {
3245
"type": "string",
3346
"metadata": {
3447
"description": "Active Directory App ID or User-Assigned Managed Identity Client ID, set as MicrosoftAppId in the Web App's Application Settings."
3548
}
49+
},
50+
"UMSIName": {
51+
"type": "string",
52+
"defaultValue": "",
53+
"metadata": {
54+
"description": "The User-Assigned Managed Identity Resource used for the Bot's Authentication."
55+
}
56+
},
57+
"UMSIResourceGroupName": {
58+
"type": "string",
59+
"defaultValue": "",
60+
"metadata": {
61+
"description": "The User-Assigned Managed Identity Resource Group used for the Bot's Authentication."
62+
}
63+
},
64+
"tenantId": {
65+
"type": "string",
66+
"defaultValue": "[subscription().tenantId]",
67+
"metadata": {
68+
"description": "The Azure AD Tenant ID to use as part of the Bot's Authentication. Only used for SingleTenant and UserAssignedMSI app types. Defaults to \"Subscription Tenant ID\"."
69+
}
70+
}
71+
},
72+
"variables": {
73+
"botEndpoint": "[if(empty(parameters('botEndpoint')), concat('https://', parameters('azureBotId'), '.azurewebsites.net/api/messages'), parameters('botEndpoint'))]",
74+
"tenantId": "[if(empty(parameters('tenantId')), subscription().tenantId, parameters('tenantId'))]",
75+
"msiResourceId": "[if(empty(parameters('UMSIName')), '', concat(subscription().id, '/resourceGroups/', parameters('UMSIResourceGroupName'), '/providers/', 'Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('UMSIName')))]",
76+
"appTypeDef": {
77+
"MultiTenant": {
78+
"tenantId": "",
79+
"msiResourceId": ""
80+
},
81+
"SingleTenant": {
82+
"tenantId": "[variables('tenantId')]",
83+
"msiResourceId": ""
84+
},
85+
"UserAssignedMSI": {
86+
"tenantId": "[variables('tenantId')]",
87+
"msiResourceId": "[variables('msiResourceId')]"
88+
}
89+
},
90+
"appType": {
91+
"tenantId": "[variables('appTypeDef')[parameters('appType')].tenantId]",
92+
"msiResourceId": "[variables('appTypeDef')[parameters('appType')].msiResourceId]"
3693
}
3794
},
3895
"resources": [
@@ -49,8 +106,11 @@
49106
"name": "[parameters('azureBotId')]",
50107
"displayName": "[parameters('azureBotId')]",
51108
"iconUrl": "https://docs.botframework.com/static/devportal/client/images/bot-framework-default.png",
52-
"endpoint": "[parameters('botEndpoint')]",
109+
"endpoint": "[variables('botEndpoint')]",
53110
"msaAppId": "[parameters('appId')]",
111+
"msaAppTenantId": "[variables('appType').tenantId]",
112+
"msaAppMSIResourceId": "[variables('appType').msiResourceId]",
113+
"msaAppType": "[parameters('appType')]",
54114
"luisAppIds": [],
55115
"schemaTransformationVersion": "1.3",
56116
"isCmekEnabled": false,

generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/template-BotApp-with-rg.json

+77-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"parameters": {
55
"appServiceName": {
66
"type": "string",
7-
"defaultValue": "",
87
"metadata": {
98
"description": "The globally unique name of the Web App."
109
}
@@ -18,18 +17,21 @@
1817
},
1918
"existingAppServicePlanLocation": {
2019
"type": "string",
20+
"defaultValue": "",
2121
"metadata": {
2222
"description": "The location of the App Service Plan."
2323
}
2424
},
2525
"newAppServicePlanName": {
2626
"type": "string",
27+
"defaultValue": "",
2728
"metadata": {
2829
"description": "The name of the new App Service Plan."
2930
}
3031
},
3132
"newAppServicePlanLocation": {
3233
"type": "string",
34+
"defaultValue": "",
3335
"metadata": {
3436
"description": "The location of the App Service Plan."
3537
}
@@ -47,6 +49,18 @@
4749
"description": "The SKU of the App Service Plan. Defaults to Standard values."
4850
}
4951
},
52+
"appType": {
53+
"type": "string",
54+
"defaultValue": "MultiTenant",
55+
"allowedValues": [
56+
"MultiTenant",
57+
"SingleTenant",
58+
"UserAssignedMSI"
59+
],
60+
"metadata": {
61+
"description": "Type of Bot Authentication. set as MicrosoftAppType in the Web App's Application Settings. Allowed values are: MultiTenant, SingleTenant, UserAssignedMSI. Defaults to \"MultiTenant\"."
62+
}
63+
},
5064
"appId": {
5165
"type": "string",
5266
"metadata": {
@@ -59,13 +73,58 @@
5973
"metadata": {
6074
"description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Required for MultiTenant and SingleTenant app types. Defaults to \"\"."
6175
}
76+
},
77+
"UMSIName": {
78+
"type": "string",
79+
"defaultValue": "",
80+
"metadata": {
81+
"description": "The User-Assigned Managed Identity Resource used for the Bot's Authentication. Defaults to \"\"."
82+
}
83+
},
84+
"UMSIResourceGroupName": {
85+
"type": "string",
86+
"defaultValue": "",
87+
"metadata": {
88+
"description": "The User-Assigned Managed Identity Resource Group used for the Bot's Authentication. Defaults to \"\"."
89+
}
90+
},
91+
"tenantId": {
92+
"type": "string",
93+
"defaultValue": "[subscription().tenantId]",
94+
"metadata": {
95+
"description": "The Azure AD Tenant ID to use as part of the Bot's Authentication. Only used for SingleTenant and UserAssignedMSI app types. Defaults to \"Subscription Tenant ID\"."
96+
}
6297
}
6398
},
6499
"variables": {
65-
"defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlanName')), 'createNewAppServicePlan', parameters('existingAppServicePlanName'))]",
66-
"useExistingServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]",
100+
"tenantId": "[if(empty(parameters('tenantId')), subscription().tenantId, parameters('tenantId'))]",
101+
"useExistingServicePlan": "[not(empty(parameters('existingAppServicePlanName')))]",
67102
"servicePlanName": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanName'), parameters('newAppServicePlanName'))]",
68-
"servicePlanLocation": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanLocation'), parameters('newAppServicePlanLocation'))]"
103+
"servicePlanLocation": "[if(variables('useExistingServicePlan'), parameters('existingAppServicePlanLocation'), parameters('newAppServicePlanLocation'))]",
104+
"msiResourceId": "[if(empty(parameters('UMSIName')), '', concat(subscription().id, '/resourceGroups/', parameters('UMSIResourceGroupName'), '/providers/', 'Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('UMSIName')))]",
105+
"appTypeDef": {
106+
"MultiTenant": {
107+
"tenantId": "",
108+
"identity": { "type": "None" }
109+
},
110+
"SingleTenant": {
111+
"tenantId": "[variables('tenantId')]",
112+
"identity": { "type": "None" }
113+
},
114+
"UserAssignedMSI": {
115+
"tenantId": "[variables('tenantId')]",
116+
"identity": {
117+
"type": "UserAssigned",
118+
"userAssignedIdentities": {
119+
"[variables('msiResourceId')]": {}
120+
}
121+
}
122+
}
123+
},
124+
"appType": {
125+
"tenantId": "[variables('appTypeDef')[parameters('appType')].tenantId]",
126+
"identity": "[variables('appTypeDef')[parameters('appType')].identity]"
127+
}
69128
},
70129
"resources": [
71130
{
@@ -89,13 +148,15 @@
89148
"comments": "Create a Web App using an App Service Plan",
90149
"type": "Microsoft.Web/sites",
91150
"apiVersion": "2015-08-01",
92-
"name": "[parameters('appServiceName')]",
93151
"location": "[variables('servicePlanLocation')]",
94152
"kind": "app,linux",
95153
"dependsOn": [
96-
"[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]"
154+
"[resourceId('Microsoft.Web/serverfarms', variables('servicePlanName'))]"
97155
],
156+
"name": "[parameters('appServiceName')]",
157+
"identity": "[variables('appType').identity]",
98158
"properties": {
159+
"name": "[parameters('appServiceName')]",
99160
"enabled": true,
100161
"hostNameSslStates": [
101162
{
@@ -124,13 +185,21 @@
124185
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
125186
"value": "true"
126187
},
188+
{
189+
"name": "MicrosoftAppType",
190+
"value": "[parameters('appType')]"
191+
},
127192
{
128193
"name": "MicrosoftAppId",
129194
"value": "[parameters('appId')]"
130195
},
131196
{
132197
"name": "MicrosoftAppPassword",
133198
"value": "[parameters('appSecret')]"
199+
},
200+
{
201+
"name": "MicrosoftAppTenantId",
202+
"value": "[variables('appType').tenantId]"
134203
}
135204
],
136205
"cors": {
@@ -167,7 +236,7 @@
167236
"phpVersion": "",
168237
"pythonVersion": "",
169238
"nodeVersion": "",
170-
"linuxFxVersion": "PYTHON|3.7",
239+
"linuxFxVersion": "PYTHON|3.9",
171240
"requestTracingEnabled": false,
172241
"remoteDebuggingEnabled": false,
173242
"remoteDebuggingVersion": "VS2017",
@@ -201,7 +270,7 @@
201270
"autoHealEnabled": false,
202271
"vnetName": "",
203272
"minTlsVersion": "1.2",
204-
"ftpsState": "AllAllowed",
273+
"ftpsState": "Disabled",
205274
"reservedInstanceCount": 0
206275
}
207276
}

0 commit comments

Comments
 (0)