This might have different reasons, we’ll collect all possible problems here.

Approval required

For restricted environments, an Microsoft 365 administrator will have to consent to using the app. You’ll get an error similar to the following if this has not been granted yet:

To fix this issue, please contact an administrator of your company, you might be able to do this from the same screen. Here is a support article outlining the process: Teams: Approve Microsoft 365 access (optional)