Microsoft Teams Tool > Introduction to Microsoft Teams Tool recipe > Configure the Microsoft Teams Tool
  

Configure the Microsoft Teams Tool

To configure and run the Microsoft Teams Tool script, perform the following steps to set up the tenant ID and client ID, authenticate securely, and enable seamless communication with Microsoft Teams channels.
  1. 1Open the Microsoft_Teams_Tool tool connection.
  2. 2On the Code tab, uncomment the configuration block and enter the TEAMS_TENANT_ID and TEAMS_CLIENT_ID property values.
  3. The following snippet shows a sample configuration block:
    ENV_FILE = ".env"
    scope = "offline_access ChatMessage.Send ChannelMessage.Send"

    answer = ""
    load_dotenv(ENV_FILE)

    #Set Teams credentials and comment it after first run
    #set_key(ENV_FILE, "TEAMS_TENANT_ID", '')
    #set_key(ENV_FILE, "TEAMS_CLIENT_ID", '')
    unset_key(ENV_FILE, "TEAMS_ACCESS_TOKEN")
    unset_key(ENV_FILE, "TEAMS_REFRESH_TOKEN")
    unset_key(ENV_FILE, "TEAMS_DEVICE_CODE")
  4. 3Save the connection.
  5. 4Run the script.
  6. During the first script run, authenticate using the web browser with the generated URL as shown in the following image:
    This image shows the generated URL and the code to be used for authentication.
  7. 5Copy and paste the authorization code to grant access, and then click Next.
  8. 6Enter your Teams credentials and wait for confirmation of successful login.
After the initial successful run, you can remove or comment out the tenant ID and client ID settings from the configuration block to secure your credentials. Alternatively, you can manually add these values to your environment variables.
After authentication is confirmed, rerun the script to interact with Microsoft Teams.