@microsoft/teamsfx package

Classes

DefaultTediousConnectionConfiguration

SQL connection configuration instance.

ErrorWithCode

Error class with code and message thrown by the SDK.

M365TenantCredential

Represent Microsoft 365 tenant identity, and it is usually used when user is not involved like time-triggered automation job.

MsGraphAuthProvider

Microsoft Graph auth provider for Teams Framework

OnBehalfOfUserCredential

Represent on-behalf-of flow to get user identity, and it is designed to be used in server side.

TeamsBotSsoPrompt

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.

TeamsUserCredential

Represent Teams current user's identity, and it is used within Teams client applications.

Interfaces

AuthenticationConfiguration

Authentication related configuration.

Configuration

Configuration for current environment.

Logger

Interface for customized logger.

ResourceConfiguration

Configuration for resources.

TeamsBotSsoPromptSettings

Settings used to configure an TeamsBotSsoPrompt instance.

TeamsBotSsoPromptTokenResponse

Token response provided by Teams Bot SSO prompt

UserInfo

UserInfo with user displayName, objectId and preferredUserName.

Type Aliases

LogFunction

Log function for customized logging.

Enums

ErrorCode

Error code to trace the error types.

LogLevel

Log level.

ResourceType

Available resource type.

Functions

createMicrosoftGraphClient(TokenCredential, string | string[])

Get Microsoft graph client.

getAuthenticationConfiguration()

Get configuration for authentication.

getLogLevel()

Get log level.

getResourceConfiguration(ResourceType, string)

Get configuration for a specific resource.

loadConfiguration(Configuration)

Initialize configuration from environment variables or configuration object and set the global instance

setLogFunction(LogFunction)

Set custom log function. Use the function if it's set. Priority is lower than setLogger.

setLogLevel(LogLevel)

Update log level helper.

setLogger(Logger)

Set custom logger. Use the output functions if it's set. Priority is higher than setLogFunction.

Function Details

createMicrosoftGraphClient(TokenCredential, string | string[])

Note

This API is 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.

function createMicrosoftGraphClient(credential: TokenCredential, scopes?: string | string[])

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.

getAuthenticationConfiguration()

Note

This API is 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()

Returns

Authentication configuration from global configuration instance, the value may be undefined if no authentication config exists in current environment.

getLogLevel()

Note

This API is 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()

Returns

LogLevel | undefined

Log level

getResourceConfiguration(ResourceType, string)

Note

This API is 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)

Parameters

resourceType
ResourceType

The type of resource

resourceName

string

The name of resource, default value is "default".

Returns

[key: string]: any

Resource configuration for target resource from global configuration instance.

loadConfiguration(Configuration)

Note

This API is 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.

setLogFunction(LogFunction)

Note

This API is 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.

function setLogFunction(logFunction?: LogFunction)

Parameters

logFunction
LogFunction

custom log function. If it's undefined, custom log function will be cleared.

setLogLevel(LogLevel)

Note

This API is 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

setLogger(Logger)

Note

This API is 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.

function setLogger(logger?: Logger)

Parameters

logger
Logger

custom logger. If it's undefined, custom logger will be cleared.