This code is based on a quick one-off script to bulk import members into Microsoft Teams private channels using the Microsoft Graph API.
It uses a minimal Flask web interface for authentication, in order to obtain and cache the OAuth2 token. Then CLI scripts can use the cached token to list information about MS Teams and to add members to private channels.
To setup on Linux (steps should be similar on Mac or Windows):
- virtualenv -p python3 env
- source env/bin/activate
- pip install -r requirements.txt
- Register the app with MS Azure and create config file oauth_settings.yml
- Look at this link for guidance: https://github.com/microsoftgraph/msgraph-training-pythondjangoapp/tree/master/demo)
- ./authenticate
- Use browser to login
- After login, close browser and press ENTER to quit script
- Use ./teams command to view info and add members