0

I am currently developing a Microsoft Teams tab app using Teams Toolkit.

The users of the app should be able to invite guest users to certain teams and edit some of the users information in AD. This requires higher permission level than the users have.

I have tried to use delegated permission but this limits the permission of the app based on the user's permissions. See https://learn.microsoft.com/en-us/graph/auth/auth-concepts

Is there a way using Teams Toolkit or, as a last resort, some other package to get a Graph API token that will allow the app to perform operations that requires permissions higher that what the user have?

For reference I list below some of the permission the app needs:

        "User.ReadBasic.All",
        "Sites.ReadWrite.All",
        "Domain.ReadWrite.All",
        "Directory.ReadWrite.All",
        "TeamMember.ReadWrite.All",
        "TeamSettings.ReadWrite.All",

Thank you!

Mihai N.
  • 3
  • 3

2 Answers2

0

There are two main types of permissions, as you've seen. The first is "Delegated", which basically means the user is "delegating" your app to do something on his/her behalf. This is of course limited to what the user themselves can/can't do, as it's basically just doing it for them. To do something -differently-, or to do without having that specific user associated with it, you need to use Application permissions. In this case, your access is essentially unlimited, BUT it means that a tenant administrator needs to consent upfront (i.e. once-off) to your application having this level of access.

"Application" permissions are therefore what you're needing in your scenario.

Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24
0

Just as Hilton mentioned, you should use "Application" permission for your scenario.

"Application" permission is designed to running from backend, so you can setup a backend web app or Azure Function to do this.

Here are the basic steps:

  1. Go to your AAD app, and add the permission you want enter image description here

  2. Consent the permission enter image description here

  3. copy client id and client secret from AAD portal enter image description here

  4. Follow the steps to get access token https://learn.microsoft.com/en-us/graph/auth-v2-service#4-get-an-access-token

By the way, recommend to use Azure Function features inside Teams Toolkit, which can help you easily setup an Azure Function in you Teams Tab project, then you can write the code inside the Azure Function to call graph api with application permission

enter image description here

SLdragon
  • 1,477
  • 16
  • 19