@microsoft/teamsfx 2.1.1-alpha.f8e51b9d8.0 → 2.2.0-alpha.07688183f.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,7 +23,7 @@ Please check the [README](https://github.com/OfficeDev/TeamsFx/blob/main/package
23
23
 
24
24
  - Node.js version 10.x.x or higher
25
25
  - A project created by the Teams Toolkit VS Code extension or `teamsfx` CLI tool.
26
- - If your project has installed `botbuilder` related [packages](https://github.com/Microsoft/botbuilder-js#packages) as dependencies, ensure they are of the same version and the version `>= 4.15.0`. ([Issue - all of the BOTBUILDER packages should be the same version](https://github.com/BotBuilderCommunity/botbuilder-community-js/issues/57#issuecomment-508538548))
26
+ - If your project has installed `botbuilder` related [packages](https://github.com/Microsoft/botbuilder-js#packages) as dependencies, ensure they are of the same version and the version `>= 4.18.0`. ([Issue - all of the BOTBUILDER packages should be the same version](https://github.com/BotBuilderCommunity/botbuilder-community-js/issues/57#issuecomment-508538548))
27
27
 
28
28
  ### Install the `@microsoft/teamsfx` package
29
29
 
@@ -36,24 +36,39 @@ npm install @microsoft/teamsfx
36
36
  ### Scenarios
37
37
 
38
38
  TeamsFx SDK is built to be used in browser and NodeJS environment. Common scenarios include:
39
+
39
40
  - Teams tab application
40
41
  - Azure Function
41
42
  - Teams bot
42
43
 
43
- ### Create and authenticate a service like `MicrosoftGraphClient`
44
+ ### Create and authenticate a service using `createMicrosoftGraphClientWithCredential` or `createMicrosoftGraphClient`
45
+
46
+ > [!NOTE] `createMicrosoftGraphClient` function has been deprecated. It is recommended that you to use `createMicrosoftGraphClientWithCredential` instead, for better coding experience.
44
47
 
45
48
  To create a graph client object to access the Microsoft Graph API, you will need the credential to do authentication. The SDK provides APIs to configure for developers. Please choose the proper identity type and follow below steps:
46
49
 
47
50
  #### Invoke Graph API on behalf of Teams User (User Identity)
48
51
 
49
- Use the snippet below:
52
+ Use the snippet below (Recommended):
53
+ ```ts
54
+ const authConfig: TeamsUserCredentialAuthConfig = {
55
+ clientId: process.env.REACT_APP_CLIENT_ID,
56
+ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
57
+ };
58
+
59
+ const teamsUserCredential = new TeamsUserCredential(authConfig);
60
+ const graphClient = createMicrosoftGraphClientWithCredential(teamsUserCredential, ["User. Read"]);
61
+ const profile = await graphClient.api("/me").get();
62
+ ```
63
+
64
+ or use `createMicrosoftGraphClient` as below (Deprecated):
50
65
 
51
66
  ```ts
52
67
  // Equivalent to:
53
68
  // const teamsfx = new TeamsFx(IdentityType.User, {
54
69
  // initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
55
70
  // clientId: process.env.REACT_APP_CLIENT_ID,
56
- // }
71
+ // });
57
72
  const teamsfx = new TeamsFx();
58
73
  const graphClient = createMicrosoftGraphClient(teamsfx, ["User.Read"]); // Initializes MS Graph SDK using our MsGraphAuthProvider
59
74
  const profile = await graphClient.api("/me").get(); // Get the profile of current user
@@ -62,7 +77,22 @@ const profile = await graphClient.api("/me").get(); // Get the profile of curren
62
77
  #### Invoke Graph API without user (Application Identity)
63
78
 
64
79
  It doesn't require the interaction with Teams user. You can call Microsoft Graph as application identity.
65
- Use the snippet below:
80
+
81
+ Use the snippet below (Recommended):
82
+ ```ts
83
+ const appAuthConfig: AppCredentialAuthConfig = {
84
+ authorityHost: process.env.M365_AUTHORITY_HOST,
85
+ clientId: process.env.M365_CLIENT_ID,
86
+ tenantId: process.env.M365_TENANT_ID,
87
+ clientSecret: process.env.M365_CLIENT_SECRET,
88
+ };
89
+
90
+ const appCredential = new AppCredential(appAuthConfig);
91
+ const graphClient = createMicrosoftGraphClientWithCredential(appCredential);
92
+ const profile = await graphClient.api("/users/{object_id_of_another_people}").get();
93
+ ```
94
+
95
+ or use `createMicrosoftGraphClient` as below (Deprecated):
66
96
 
67
97
  ```ts
68
98
  // Equivalent to:
@@ -78,26 +108,32 @@ const profile = await graphClient.api("/users/{object_id_of_another_people}").ge
78
108
  ## Core Concepts & Code Structure
79
109
 
80
110
  ### TeamsFx class
111
+
112
+ > [!NOTE] `TeamsFx` class has been deprecated. It is recommended that you to use different credentials (`TeamsUserCredential`, `AppCredential`, `OnBehalfOfUserCredential`) instead, for better coding experience.
113
+
81
114
  `TeamsFx` class instance reads all TeamsFx settings from environment variables by default. You can also set customized configuration values to override the default values. Please check [Override configuration](#override-configuration) for details.
82
115
 
83
116
  When creating a TeamsFx instance, you also need to specify the identity type. There are 2 identity types:
84
117
 
85
118
  #### User Identity
119
+
86
120
  Using `new TeamsFx(IdentityType.User)` means the application will be authenticated as current Teams user. This one is the default choice. You need to call `TeamsFx:setSsoToken()` when you use user identity in NodeJS environment(without browser).
87
121
 
88
122
  You can use `TeamsFx:getUserInfo()` to get user's basic information.
89
123
  `TeamsFx:login()` is used to let user perform consent process if you want to use SSO to get access token for certain OAuth scopes.
90
124
 
91
125
  #### Application Identity
126
+
92
127
  Using `new TeamsFx(IdentityType.App)` means the application will be authenticated as an application. The permission usually need administrator's approval.
93
128
 
94
129
  `TeamsFx:getCredential()` provides credential instances automatically corresponding to identity type:
130
+
95
131
  - User Identity: It means that you can access resources on behalf of current Teams user.
96
132
  - App Identity: It means that you are acting as a managed app identity which usually need admin consent for resources.
97
133
 
98
134
  ### Credential
99
135
 
100
- //Developers should choose identity type when initializing TeamsFx. SDK provides 2 types: User and App.
136
+ Developers should choose identity type when initializing TeamsFx. SDK provides 2 types: User and App.
101
137
  After developer has specified the identity type when initializing TeamsFx, SDK uses different kinds of credential class to represent the identity and get access token by corresponding auth flow.
102
138
 
103
139
  There are 3 credential classes that are used to help simplifying authentication. They are located under [credential](src/credential) folder.
@@ -106,19 +142,57 @@ Credential classes implements `TokenCredential` interface that is broadly used i
106
142
  Here's the corresponding scenarios that each credential class targets.
107
143
 
108
144
  #### User Identity in browser environment
145
+
109
146
  `TeamsUserCredential` represents Teams current user's identity. Using this credential will request user consent at the first time. It leverages the Teams SSO and On-Behalf-Of flow to do token exchange. SDK uses this credential when developer choose "User" identity in browser environment.
110
147
 
111
- Required configuration: initiateLoginEndpoint, clientId.
148
+ The following code is an an example to create TeamsUserCredential:
149
+ ```ts
150
+ const authConfig: TeamsUserCredentialAuthConfig = {
151
+ clientId: process.env.REACT_APP_CLIENT_ID,
152
+ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
153
+ };
154
+
155
+ const credential = new TeamsUserCredential(authConfig);
156
+ ```
157
+
158
+ Required configurations are initiateLoginEndpoint and clientId which can be found inside type TeamsUserCredentialAuthConfig.
112
159
 
113
160
  #### User Identity in NodeJS environment
161
+
114
162
  `OnBehalfOfUserCredential` uses On-Behalf-Of flow and need Teams ssoToken. It's designed to be used in Azure Function or Bot scenarios. SDK uses this credential when developer choose "User" identity in NodeJS environment.
115
163
 
116
- Required configuration: authorityHost, tenantId, clientId, clientSecret / certificateContent.
164
+ The following code is an example to create OnBehalfOfUserCredential:
165
+ ```ts
166
+ const oboAuthConfig: OnBehalfOfCredentialAuthConfig = {
167
+ authorityHost: process.env.M365_AUTHORITY_HOST,
168
+ clientId: process.env.M365_CLIENT_ID,
169
+ tenantId: process.env.M365_TENANT_ID,
170
+ clientSecret: process.env.M365_CLIENT_SECRET,
171
+ };
172
+
173
+ const oboCredential = new OnBehalfOfUserCredential(ssoToken, oboAuthConfig);
174
+ ```
175
+
176
+ Required configurations are authorityHost, tenantId, clientId, clientSecret, or certificateContent which can be found inside type OnBehalfOfCredentialAuthConfig.
117
177
 
118
178
  #### Application Identity in NodeJS environment
179
+
119
180
  `AppCredential` represents the application identity. It is usually used when user is not involved like time-triggered automation job. SDK uses this credential when developer choose "App" identity in NodeJS environment.
120
181
 
121
- Required configuration: tenantId, clientId, clientSecret / certificateContent.
182
+
183
+ The following code is an example to create `AppCredential`:
184
+
185
+ ```ts
186
+ const appAuthConfig: AppCredentialAuthConfig = {
187
+ authorityHost: process.env.M365_AUTHORITY_HOST,
188
+ clientId: process.env.M365_CLIENT_ID,
189
+ tenantId: process.env.M365_TENANT_ID,
190
+ clientSecret: process.env.M365_CLIENT_SECRET,
191
+ };
192
+ const appCredential = new AppCredential(appAuthConfig);
193
+ ```
194
+
195
+ Required configurations are authorityHost, tenantId, clientId, clientSecret, or certificateContent which can be found inside type AppCredentialAuthConfig.
122
196
 
123
197
  ### Bot SSO
124
198
 
@@ -126,19 +200,41 @@ Bot related classes are stored under [bot](src/bot) folder.
126
200
 
127
201
  `TeamsBotSsoPrompt` has a good integration with Bot framework. It simplifies the authentication process when you develops bot application and want to leverage the Bot SSO.
128
202
 
129
- Required configuration: initiateLoginEndpoint, tenantId, clientId, applicationIdUri.
203
+ The following code is an example to create `TeamsBotSsoPrompt`:
204
+
205
+ ```ts
206
+ const TeamsBotSsoPromptId = "TEAMS_BOT_SSO_PROMPT";
207
+
208
+ const settings: TeamsBotSsoPromptSettings = {
209
+ scopes: ["User.Read"],
210
+ timeout: 900000,
211
+ endOnInvalidMessage: true,
212
+ };
213
+
214
+ const authConfig: OnBehalfOfCredentialAuthConfig = {
215
+ authorityHost: process.env.M365_AUTHORITY_HOST,
216
+ clientId: process.env.M365_CLIENT_ID,
217
+ tenantId: process.env.M365_TENANT_ID,
218
+ clientSecret: process.env.M365_CLIENT_SECRET,
219
+ };
220
+ const loginUrl = process.env.INITIATE_LOGIN_ENDPOINT;
221
+ const ssoPrompt = new TeamsBotSsoPrompt(authConfig, loginUrl, TeamsBotSsoPromptId, settings);
222
+ ```
130
223
 
131
224
  ### Helper Function
132
225
 
133
226
  TeamsFx SDK provides several helper functions to ease the configuration for third-party libraries. They are located under [core](src/core) folder.
134
227
 
135
228
  #### Microsoft Graph Service
136
- `createMicrosoftGraphClient` and `MsGraphAuthProvider` help to create authenticated Graph instance.
229
+
230
+ `createMicrosoftGraphClientWithCredential`, `createMicrosoftGraphClient`(deprecated) and `MsGraphAuthProvider` help to create authenticated Graph instance.
137
231
 
138
232
  #### SQL
139
- `getTediousConnectionConfig` returns a tedious connection config.
233
+
234
+ `getTediousConnectionConfig` returns a tedious connection config. This API is now deprecated, we recommend you compose your own Tedious configuration for better flexibility.
140
235
 
141
236
  Required configuration:
237
+
142
238
  - sqlServerEndpoint, sqlUsername, sqlPassword if you want to use user identity
143
239
  - sqlServerEndpoint, sqlIdentityId if you want to use MSI identity
144
240
 
@@ -150,8 +246,13 @@ For example, to filter out specific error, you could use the following check:
150
246
 
151
247
  ```ts
152
248
  try {
153
- const teamsfx = new TeamsFx();
154
- await teamsfx.login("User.Read");
249
+ const authConfig: TeamsUserCredentialAuthConfig = {
250
+ clientId: process.env.REACT_APP_CLIENT_ID,
251
+ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
252
+ };
253
+
254
+ const credential = new TeamsUserCredential(authConfig);
255
+ await credential.login("User.Read");
155
256
  } catch (err: unknown) {
156
257
  if (err instanceof ErrorWithCode && err.code !== ErrorCode.ConsentFailed) {
157
258
  throw err;
@@ -166,8 +267,13 @@ And if credential instance is used in other library like Microsoft Graph, it's p
166
267
 
167
268
  ```ts
168
269
  try {
169
- const teamsfx = new TeamsFx();
170
- const graphClient = createMicrosoftGraphClient(teamsfx, ["User.Read"]); // Initializes MS Graph SDK using our MsGraphAuthProvider
270
+ const authConfig: TeamsUserCredentialAuthConfig = {
271
+ clientId: process.env.REACT_APP_CLIENT_ID,
272
+ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
273
+ };
274
+
275
+ const credential = new TeamsUserCredential(authConfig);
276
+ const graphClient = createMicrosoftGraphClientWithCredential(credential, ["User.Read"]); // Initializes MS Graph SDK using our MsGraphAuthProvider
171
277
  const profile = await graphClient.api("/me").get();
172
278
  } catch (err: unknown) {
173
279
  // ErrorWithCode is handled by Graph client
@@ -191,12 +297,29 @@ The following sections provide several code snippets covering some of the most c
191
297
 
192
298
  ### Use Graph API in tab app
193
299
 
194
- Use `TeamsFx` and `createMicrosoftGraphClient`.
300
+ Use `createMicrosoftGraphClientWithCredential`.
195
301
 
196
302
  ```ts
197
- const teamsfx = new TeamsFx();
198
- const graphClient = createMicrosoftGraphClient(teamsfx, ["User.Read"]);
199
- const profile = await graphClient.api("/me").get();
303
+ const authConfig: TeamsUserCredentialAuthConfig = {
304
+ clientId: process.env.REACT_APP_CLIENT_ID,
305
+ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
306
+ };
307
+
308
+ const teamsUserCredential = new TeamsUserCredential(authConfig);
309
+
310
+ // Put login code in a call-to-action callback function to avoid browser blocking automatically showing up pop-ups.
311
+ await teamsUserCredential.login(["User.Read"]); // Login with scope
312
+
313
+ try {
314
+ const graphClient = createMicrosoftGraphClientWithCredential(teamsUserCredential, ["User. Read"]); // Initializes MS Graph SDK using our MsGraphAuthProvider
315
+ const profile = await graphClient.api("/me").get();
316
+ } catch (err: unknown) {
317
+ // ErrorWithCode is handled by Graph client
318
+ if (err instanceof GraphError && err.code?.includes(ErrorCode.UiRequiredError)) {
319
+ // Need to show login button to ask for user consent.
320
+ }
321
+ }
322
+
200
323
  ```
201
324
 
202
325
  ### Call Azure Function in tab app
@@ -204,14 +327,21 @@ const profile = await graphClient.api("/me").get();
204
327
  Use `axios` library to make HTTP request to Azure Function.
205
328
 
206
329
  ```ts
207
- const teamsfx = new TeamsFx();
208
- const credential = teamsfx.getCredential();
209
- // Create an API client that uses SSO token to authenticate requests
210
- const apiClient = createApiClient(
211
- teamsfx.getConfig("apiEndpoint"),
212
- new BearerTokenAuthProvider(async ()=> (await credential.getToken(""))!.token));
213
- // Call API hosted in Azure Functions on behalf of user
214
- const response = await apiClient.get("/api/" + functionName);
330
+ async function callFunction() {
331
+ const authConfig: TeamsUserCredentialAuthConfig = {
332
+ clientId: process.env.REACT_APP_CLIENT_ID,
333
+ initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
334
+ };
335
+ const teamsUserCredential = new TeamsUserCredential(authConfig);
336
+ const accessToken = await teamsUserCredential.getToken(""); // Get SSO token
337
+ const endpoint = "https://YOUR_API_ENDPOINT";
338
+ const response = await axios.default.get(endpoint + "/api/" + functionName, {
339
+ headers: {
340
+ authorization: "Bearer " + accessToken.token,
341
+ },
342
+ });
343
+ return response.data;
344
+ }
215
345
  ```
216
346
 
217
347
  ### Access SQL database in Azure Function
@@ -219,6 +349,8 @@ const response = await apiClient.get("/api/" + functionName);
219
349
  Use `tedious` library to access SQL and leverage `DefaultTediousConnectionConfiguration` that manages authentication.
220
350
  Apart from `tedious`, you can also compose connection config of other SQL libraries based on the result of `sqlConnectionConfig.getConfig()`.
221
351
 
352
+ The `tedious` library is now deprecated, we recommend you compose your own Tedious configuration for better flexibility.
353
+
222
354
  ```ts
223
355
  // Equivalent to:
224
356
  // const sqlConnectConfig = new DefaultTediousConnectionConfiguration({
@@ -242,10 +374,14 @@ connection.on("connect", (error) => {
242
374
  ### Use certificate-based authentication in Azure Function
243
375
 
244
376
  ```ts
245
- const teamsfx = new TeamsFx(IdentityType.App, {
246
- certificateContent: "The content of a PEM-encoded public/private key certificate"
247
- });
248
- const token = teamsfx.getCredential().getToken();
377
+ const appAuthConfig: AppCredentialAuthConfig = {
378
+ authorityHost: process.env.M365_AUTHORITY_HOST,
379
+ clientId: process.env.M365_CLIENT_ID,
380
+ tenantId: process.env.M365_TENANT_ID,
381
+ certificateContent: 'PEM-encoded key certificate',
382
+ };
383
+ const appCredential = new AppCredential(appAuthConfig);
384
+ const token = appCredential.getToken();
249
385
  ```
250
386
 
251
387
  ### Use Graph API in Bot application
@@ -255,18 +391,30 @@ Add `TeamsBotSsoPrompt` to dialog set.
255
391
  ```ts
256
392
  const { ConversationState, MemoryStorage } = require("botbuilder");
257
393
  const { DialogSet, WaterfallDialog } = require("botbuilder-dialogs");
258
- const { TeamsBotSsoPrompt } = require("@microsoft/teamsfx");
394
+ const { TeamsBotSsoPrompt, OnBehalfOfCredentialAuthConfig, TeamsBotSsoPromptSettings } = require("@microsoft/teamsfx");
259
395
 
260
396
  const convoState = new ConversationState(new MemoryStorage());
261
397
  const dialogState = convoState.createProperty("dialogState");
262
398
  const dialogs = new DialogSet(dialogState);
263
399
 
264
- const teamsfx = new TeamsFx();
265
- dialogs.add(
266
- new TeamsBotSsoPrompt(teamsfx, "TeamsBotSsoPrompt", {
267
- scopes: ["User.Read"],
268
- })
269
- );
400
+ const TeamsBotSsoPromptId = "TEAMS_BOT_SSO_PROMPT";
401
+
402
+ const settings: TeamsBotSsoPromptSettings = {
403
+ scopes: ["User.Read"],
404
+ timeout: 900000,
405
+ endOnInvalidMessage: true,
406
+ };
407
+
408
+ const authConfig: OnBehalfOfCredentialAuthConfig = {
409
+ authorityHost: process.env.M365_AUTHORITY_HOST,
410
+ clientId: process.env.M365_CLIENT_ID,
411
+ tenantId: process.env.M365_TENANT_ID,
412
+ clientSecret: process.env.M365_CLIENT_SECRET,
413
+ };
414
+ const loginUrl = process.env.INITIATE_LOGIN_ENDPOINT;
415
+ const ssoPrompt = new TeamsBotSsoPrompt(authConfig, loginUrl, TeamsBotSsoPromptId, settings);
416
+
417
+ dialogs.add(ssoPrompt);
270
418
 
271
419
  dialogs.add(
272
420
  new WaterfallDialog("taskNeedingLogin", [
@@ -293,15 +441,18 @@ const teamsfx = new TeamsFx();
293
441
 
294
442
  // Create an API Key auth provider. Following auth providers are also available:
295
443
  // BearerTokenAuthProvider, BasicAuthProvider, CertificateAuthProvider
296
- const authProvider = new ApiKeyProvider("your_api_key_name",
444
+ const authProvider = new ApiKeyProvider(
445
+ "your_api_key_name",
297
446
  teamsfx.getConfig("YOUR_API_KEY_VALUE"), // This reads the value of YOUR_API_KEY_VALUE environment variable
298
- ApiKeyLocation.Header);
447
+ ApiKeyLocation.Header
448
+ );
299
449
 
300
450
  // Create an API client using above auth provider
301
451
  // You can also implement AuthProvider interface and use it here
302
452
  const apiClient = createApiClient(
303
453
  teamsfx.getConfig("YOUR_API_ENDPOINT"), // This reads YOUR_API_ENDPOINT environment variable
304
- authProvider);
454
+ authProvider
455
+ );
305
456
 
306
457
  // Send a GET request to "relative_api_path"
307
458
  const response = await apiClient.get("relative_api_path");
@@ -352,36 +503,38 @@ setLogFunction((level: LogLevel, message: string) => {
352
503
  });
353
504
  ```
354
505
 
355
-
356
506
  ### Override configuration
507
+
357
508
  You can pass custom config when creating `TeamsFx` instance to override default configuration or set required fields when environment variables are missing.
358
509
 
359
510
  - If you have created tab project using VS Code toolkit, the following config values will be used from pre-configured environment variables:
360
- * authorityHost (REACT_APP_AUTHORITY_HOST)
361
- * tenantId (REACT_APP_TENANT_ID)
362
- * clientId (REACT_APP_CLIENT_ID)
363
- * initiateLoginEndpoint (REACT_APP_START_LOGIN_PAGE_URL)
364
- * applicationIdUri (REACT_APP_START_LOGIN_PAGE_URL)
365
- * apiEndpoint (REACT_APP_FUNC_ENDPOINT)
366
- * apiName (REACT_APP_FUNC_NAME)
511
+
512
+ - authorityHost (REACT_APP_AUTHORITY_HOST)
513
+ - tenantId (REACT_APP_TENANT_ID)
514
+ - clientId (REACT_APP_CLIENT_ID)
515
+ - initiateLoginEndpoint (REACT_APP_START_LOGIN_PAGE_URL)
516
+ - applicationIdUri (REACT_APP_START_LOGIN_PAGE_URL)
517
+ - apiEndpoint (REACT_APP_FUNC_ENDPOINT)
518
+ - apiName (REACT_APP_FUNC_NAME)
367
519
 
368
520
  - If you have created Azure Function / Bot project using VS Code toolkit, the following config values will be used from pre-configured environment variables:
369
- * initiateLoginEndpoint (INITIATE_LOGIN_ENDPOINT)
370
- * authorityHost (M365_AUTHORITY_HOST)
371
- * tenantId (M365_TENANT_ID)
372
- * clientId (M365_CLIENT_ID)
373
- * clientSecret (M365_CLIENT_SECRET)
374
- * applicationIdUri (M365_APPLICATION_ID_URI)
375
- * apiEndpoint (API_ENDPOINT)
376
- * sqlServerEndpoint (SQL_ENDPOINT)
377
- * sqlUsername (SQL_USER_NAME)
378
- * sqlPassword (SQL_PASSWORD)
379
- * sqlDatabaseName (SQL_DATABASE_NAME)
380
- * sqlIdentityId (IDENTITY_ID)
521
+ - initiateLoginEndpoint (INITIATE_LOGIN_ENDPOINT)
522
+ - authorityHost (M365_AUTHORITY_HOST)
523
+ - tenantId (M365_TENANT_ID)
524
+ - clientId (M365_CLIENT_ID)
525
+ - clientSecret (M365_CLIENT_SECRET)
526
+ - applicationIdUri (M365_APPLICATION_ID_URI)
527
+ - apiEndpoint (API_ENDPOINT)
528
+ - sqlServerEndpoint (SQL_ENDPOINT)
529
+ - sqlUsername (SQL_USER_NAME)
530
+ - sqlPassword (SQL_PASSWORD)
531
+ - sqlDatabaseName (SQL_DATABASE_NAME)
532
+ - sqlIdentityId (IDENTITY_ID)
381
533
 
382
534
  ## How to fix the breaking change if upgraded from previous SDK version
383
535
 
384
536
  If you are using the version of SDK that has `loadConfiguration()`, you can follow these steps to upgrade to the latest SDK version.
537
+
385
538
  1. Remove `loadConfiguration()` and pass customized settings using `new TeamsFx(IdentityType.User, { ...customConfig })`.
386
539
  2. Replace `new TeamsUserCredential()` with `new TeamsFx()`.
387
540
  3. Replace `new M365TenantCredential()` with `new TeamsFx(IdentityType.App)`.
@@ -390,6 +543,29 @@ If you are using the version of SDK that has `loadConfiguration()`, you can foll
390
543
 
391
544
  Also see [TeamsFx class](#teamsfx-class) for furthur description.
392
545
 
546
+ ## How to use SDK implemented with `CloudAdapter`
547
+
548
+ From `botbuilder@4.16.0`, `BotFrameworkAdapter` is deprecated, and `CloudAdapter` is recommended to be used instead. You can import `ConversationBot` from `BotBuilderCloudAdapter` to use the latest SDK implemented with `CloudAdapter`.
549
+
550
+ ```ts
551
+ const { BotBuilderCloudAdapter } = require("@microsoft/teamsfx");
552
+ const ConversationBot = BotBuilderCloudAdapter.ConversationBot;
553
+
554
+ const commandBot = new ConversationBot({
555
+ // The bot id and password to create CloudAdapter.
556
+ // See https://aka.ms/about-bot-adapter to learn more about adapters.
557
+ adapterConfig: {
558
+ MicrosoftAppId: config.botId,
559
+ MicrosoftAppPassword: config.botPassword,
560
+ MicrosoftAppType: "MultiTenant",
561
+ },
562
+ command: {
563
+ enabled: true,
564
+ commands: [new HelloWorldCommandHandler()],
565
+ },
566
+ });
567
+ ```
568
+
393
569
  ## Next steps
394
570
 
395
571
  Please take a look at the [Samples](https://github.com/OfficeDev/TeamsFx-Samples) project for detailed examples on how to use this library.