Not able to make requests to Microsoft Graph API endpoints

A dB 41 Reputation points
2022-02-09T19:14:38.087+00:00

I have a simple application in Python that I want to use to schedule and gather attendance information on online meetings using Microsoft Graph API. I made a developer account on Azure and created an enterprise application to access the API. My account has Global Admin privileges and I have granted all the necessary Microsoft Graph API permissions to the application.

I use the MSAL class "ConfidentialClientApplication" to initialize the app with the client id, the authority url (with my tenant id), and the client secret. I am able to retrieve a token that contains the list of permissions I need, but it seems that I do not have the permissions when making the API calls.

All I need is the access to the onlineMeetings and meetingAttendanceReports end points.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,631 questions
{count} votes

Accepted answer
  1. CarlZhao-MSFT 40,311 Reputation points
    2022-02-11T02:43:26.647+00:00

    Hi @A dB

    This is because you didn't create an application access policy, according to the official doc: to use application permission for this API, tenant administrators must create an application access policy and grant it to a user to authorize the app configured in the policy to create online meetings on behalf of that user (with user ID specified in the request path).

    173404-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Vinicius Ribeiro 1 Reputation point
    2022-02-09T20:40:47.083+00:00

    Hi @A dB ,

    Recently I did a python solution too that queries Sites from MSGraph.

    To authenticate the solution, I just create a new App Registration :
    * API Permissions > MSGraph > What you need
    * Certificates & Secrets > Create New Secret > Copy the Secret Value

    Imports used:

    import adal
    import json
    import requests

    Authentication Block:

    resource_URL ='https://graph.microsoft.com'
    authority_url = 'https://login.microsoftonline.com/%s'%(tenant)

    context = adal.AuthenticationContext(authority_url)

    token = context.acquire_token_with_client_credentials(
    resource_URL,
    <app id or client id>,
    <secret>)

    request_headers = {'Authorization': 'Bearer {0}'.format(token["accessToken"])}

    Hope that helps.