@microsoft/teamsfx package
Default |
SQL connection configuration instance. |
Error |
Error class with code and message thrown by the SDK. |
M365Tenant |
Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job. Example TypeScript
|
Ms |
Microsoft Graph auth provider for Teams Framework |
On |
Represent on-behalf-of flow to get user identity, and it is designed to be used in server side. Example TypeScript
|
Teams |
Creates a new prompt that leverage Teams Single Sign On (SSO) support for bot to automatically sign in user and help receive oauth token, asks the user to consent if needed. Example When used with your bots JavaScript
|
Teams |
Represent Teams current user's identity, and it is used within Teams client applications. |
Authentication |
Authentication related configuration. |
Configuration |
Configuration for current environment. |
Get |
Defines options for TokenCredential.getToken. |
Logger |
Interface for customized logger. |
Resource |
Configuration for resources. |
Teams |
Settings used to configure an TeamsBotSsoPrompt instance. |
Teams |
Token response provided by Teams Bot SSO prompt |
Token |
Represents a credential capable of providing an authentication token. |
User |
UserInfo with user displayName, objectId and preferredUserName. |
Log |
Log function for customized logging. |
Error |
Error code to trace the error types. |
Log |
Log level. |
Resource |
Available resource type. |
create |
Get Microsoft graph client. Example Get Microsoft graph client by TokenCredential TypeScript
|
get |
Get configuration for authentication. |
get |
Get log level. |
get |
Get configuration for a specific resource. |
load |
Initialize configuration from environment variables or configuration object and set the global instance |
set |
Set custom log function. Use the function if it's set. Priority is lower than setLogger. Example TypeScript
|
set |
Update log level helper. |
set |
Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction. Example TypeScript
|
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get Microsoft graph client.
Example
Get Microsoft graph client by TokenCredential
// Sso token example (Azure Function)
const ssoToken = "YOUR_TOKEN_STRING";
const options = {"AAD_APP_ID", "AAD_APP_SECRET"};
const credential = new OnBehalfOfAADUserCredential(ssoToken, options);
const graphClient = await createMicrosoftGraphClient(credential);
const profile = await graphClient.api("/me").get();
// TeamsBotSsoPrompt example (Bot Application)
const requiredScopes = ["User.Read"];
const config: Configuration = {
loginUrl: loginUrl,
clientId: clientId,
clientSecret: clientSecret,
tenantId: tenantId
};
const prompt = new TeamsBotSsoPrompt(dialogId, {
config: config
scopes: '["User.Read"],
});
this.addDialog(prompt);
const oboCredential = new OnBehalfOfAADUserCredential(
getUserId(dialogContext),
{
clientId: "AAD_APP_ID",
clientSecret: "AAD_APP_SECRET"
});
try {
const graphClient = await createMicrosoftGraphClient(credential);
const profile = await graphClient.api("/me").get();
} catch (e) {
dialogContext.beginDialog(dialogId);
return Dialog.endOfTurn();
}
function createMicrosoftGraphClient(credential: TokenCredential, scopes?: string | string[]): Client
Parameters
- credential
- TokenCredential
token credential instance.
- scopes
-
string | string[]
The array of Microsoft Token scope of access. Default value is [.default]
.
Returns
Client
Graph client with specified scopes.
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get configuration for authentication.
function getAuthenticationConfiguration(): AuthenticationConfiguration | undefined
Returns
AuthenticationConfiguration | undefined
Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get log level.
function getLogLevel(): LogLevel | undefined
Returns
LogLevel | undefined
Log level
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get configuration for a specific resource.
function getResourceConfiguration(resourceType: ResourceType, resourceName?: string): {[index: string]: any}
Parameters
- resourceType
- ResourceType
The type of resource
- resourceName
-
string
The name of resource, default value is "default".
Returns
{[index: string]: any}
Resource configuration for target resource from global configuration instance.
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Initialize configuration from environment variables or configuration object and set the global instance
function loadConfiguration(configuration?: Configuration)
Parameters
- configuration
- Configuration
Optional configuration that overrides the default configuration values. The override depth is 1.
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Set custom log function. Use the function if it's set. Priority is lower than setLogger.
Example
setLogFunction((level: LogLevel, message: string) => {
if (level === LogLevel.Error) {
console.log(message);
}
});
function setLogFunction(logFunction?: LogFunction)
Parameters
- logFunction
- LogFunction
custom log function. If it's undefined, custom log function will be cleared.
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Update log level helper.
function setLogLevel(level: LogLevel)
Parameters
- level
- LogLevel
log level in configuration
Note
This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.
Example
setLogger({
verbose: console.debug,
info: console.info,
warn: console.warn,
error: console.error,
});
function setLogger(logger?: Logger)
Parameters
- logger
- Logger
custom logger. If it's undefined, custom logger will be cleared.