Issue with publishing teams apps

Magnus Jakobsen 6 Reputation points
2022-09-23T08:11:28.66+00:00

I am using an AppRegistration+ServicePrincipal to fetch a graph token for various tasks. This has been working fine until I tried to publish a teamsApp. At first I got the error that I was missing the AppCatalog.ReadWrite.All permission on my app, but after that was added I started receiving this error:

User not authorized to perform this operation. UserId: '00e4cfb7-b765-4d85-b337-f2b65c6395b0', TenantId: 'my tenantId'

The UserId that is referred to is the integrated ServicePrincipal 'Microsoft Teams Graph Service'. So I thought that that SP needed some more permissions, so I added the AppCatalog.ReadWrite.All permission to that as well. But it still won't work.

In both SP's I tried adding both the delegated and application type.

Anyone have any idea on how to solve this issue?
I can't find anything in the documentation that tells me what I have done wrong, and where the 'Microsoft Teams Graph Service' comes into play. The error-message doesn't really give a clear picture of what the problem is.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,486 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Christian Moser 36 Reputation points
    2022-11-28T08:32:14.483+00:00

    I have the exact same issue publishing a teams app.

    I'm using m365-cli and run the following command with my service principal logged in

    m365 teams app publish --filePath ./package/deploy-me-please.zip --debug
    Error: User not authorized to perform this operation. UserId: 'f21736ab-b1db-432e-a44b-1bac0cdcc051', TenantId: '$tenantId'

    The UserId pointing also to Microsoft Teams Graph Service

    @Magnus Jakobsen did you ever found a solution?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.