Commit ada7676
authored
Fix bicep files now that multi-tenant is no longer permitted (#292)
Fixes `Multitenant bot creation is deprecated. Please use SingleTenant
or UserAssignedMSI`.
MSFT deprecated Multi-Tenant app registrations (see
https://docs.azure.cn/en-us/bot-service/provision-and-publish-a-bot?view=azure-bot-service-4.0&tabs=userassigned%2Ccsharp).
<img width="800" height="691" alt="image"
src="https://github.com/user-attachments/assets/9b989c9e-5e58-4efb-aecb-9b40f0cbcab2"
/>
This requires certain updates to our bicep files to ensure that users
can still use ATK to provision new bots. I tested this change by
Creating a fresh new echo bot and using ATK to deploy it without any
manual effort.
Future versions of the CLI (@preview9 onward) will have this fixed, but
for now, you need to manually make the changes demonstrated in this PR.
OR If you prefer using Github Copilot, just use this prompt:
```
Please update the Azure Bicep templates to migrate from app registration authentication to managed identity authentication for the Azure Bot Framework. You'll be working with two files that currently
use the old app registration pattern.
**File: infra/azure.bicep**
The current file uses `botAadAppClientId` and `botAadAppClientSecret` parameters. Please make these changes:
1. **Remove these parameters:**
```bicep
@description('Required when create Azure Bot service')
param botAadAppClientId string
@secure()
@description('Required by Bot Framework package in your bot project')
param botAadAppClientSecret string
2. Add new parameter after the existing parameters:
param identityName string = resourceBaseName
3. Add managed identity resource before the serverfarm resource:
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
location: location
name: identityName
}
4. Update the webApp resource:
- Change comment from "Web App that hosts your bot" to "Web App that hosts your agent"
- Update Node.js version from '~16' to '~18'
- Replace the BOT_ID and BOT_PASSWORD app settings with:
{
name: 'BOT_ID'
value: identity.properties.clientId
}
{
name: 'BOT_TENANT_ID'
value: identity.properties.tenantId
}
{
name: 'BOT_TYPE'
value: 'UserAssignedMsi'
}
- Add identity configuration after the properties section:
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${identity.id}': {}
}
}
5. Update the azureBotRegistration module parameters:
Replace botAadAppClientId: botAadAppClientId with:
identityClientId: identity.properties.clientId
identityResourceId: identity.id
identityTenantId: identity.properties.tenantId
6. Add new outputs:
output BOT_ID string = identity.properties.clientId
output BOT_TENANT_ID string = identity.properties.tenantId
File: infra/botRegistration/azurebot.bicep
1. Replace the botAadAppClientId parameter with these three:
param identityResourceId string
param identityClientId string
param identityTenantId string
2. Update the botService resource properties:
Replace msaAppId: botAadAppClientId with:
msaAppId: identityClientId
msaAppMSIResourceId: identityResourceId
msaAppTenantId:identityTenantId
msaAppType:'UserAssignedMSI'
These changes eliminate the need for managing bot secrets and use Azure's managed identity for more secure authentication.
```1 parent 300f6f1 commit ada7676
File tree
9 files changed
+127
-62
lines changed- .github/workflows
- packages/cli/configs/atk
- basic
- csharp/TeamsApp/infra
- botRegistration
- typescript/infra
- botRegistration
- embed/typescript/infra
- botRegistration
- oauth/typescript/infra
- tests/dialogs
9 files changed
+127
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
Lines changed: 26 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 6 | | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
17 | 10 | | |
18 | 11 | | |
19 | 12 | | |
| 13 | + | |
20 | 14 | | |
21 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
| 31 | + | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
74 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
75 | 86 | | |
76 | 87 | | |
77 | 88 | | |
| |||
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
| 94 | + | |
| 95 | + | |
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
Lines changed: 27 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 6 | | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
17 | 10 | | |
18 | 11 | | |
19 | 12 | | |
| 13 | + | |
20 | 14 | | |
21 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
| 31 | + | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
74 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
75 | 86 | | |
76 | 87 | | |
77 | 88 | | |
| |||
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
| 94 | + | |
| 95 | + | |
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
Lines changed: 26 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 6 | | |
14 | 7 | | |
15 | 8 | | |
16 | 9 | | |
17 | 10 | | |
18 | 11 | | |
19 | 12 | | |
| 13 | + | |
20 | 14 | | |
21 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
| 31 | + | |
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
| 56 | + | |
58 | 57 | | |
59 | 58 | | |
60 | | - | |
61 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
74 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
75 | 86 | | |
76 | 87 | | |
77 | 88 | | |
| |||
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
| 94 | + | |
| 95 | + | |
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
0 commit comments