Neema Bisht
Neema Bisht

Reputation: 17

Microsoft graph api - Tenant not recognized

I created an app in App Registrations service in Azure portal to access Microsoft 365 graph api's.

I could create token using https://login.microsoftonline.com/570fa6c*************************f233/oauth2/v2.0/token , but when i tried https://graph.microsoft.com/v1.0/reports/getTeamsUserActivityUserCounts(period='D7') using the token generated above, i am getting error - We do not recognize this tenant ID 570****************f233. Please double-check the tenant ID and try again

I have a free trial subscription

Could you please help, what am i missing here.

Thanks,

Neema

Upvotes: 1

Views: 1038

Answers (1)

RahulKumarShaw
RahulKumarShaw

Reputation: 4610

I tested in my environment and it is working fine for me please use the below steps so you do not missed anything.

  1. Created an application in Azure AD and given Application -> Report.Read.All API permission.

enter image description here

  1. Generated access token using postman with below Parameter passed in Body.

          https://login.microsoftonline.com/tenantid/oauth2/v2.0/token
    

enter image description here

  1. Add an assignment to above AzureAD application with Reports reader Administrative roles in Microsoft Teams.

enter image description here

Add Assignment->Select Member->Search you application and add it.

enter image description here

  1. Now finally run the getTeamsUserActivityUserCounts API with Authorization Key Bearer {token}.

For me showing the blackOuput as I have no activity for any users.

enter image description here

Upvotes: 0

Related Questions