Hi @Ankit Kumar,
Thank you for posting your query on Microsoft Q&A.
Based on your query, I understand you would like to retrieve the user details and device enrollment using Graph API and facing the issue.
I see you would like to retrieve user details from Tenant using Microsoft Graph API. I would request you to login as Global Administrators to retrieve the details.
To retrieve the details of the user, please provide this permission to your admin account: User.ReadWrite.All
To retrieve the details of the Intune enrollment details, we need this permission: DeviceManagementServiceConfig.ReadWrite.All or DeviceManagementServiceConfig.Read.All
You can use this document of Graph API permissions for reference: Microsoft Graph permissions reference.
You will receive Error 404 when the requested resources are not available. You may need to check the user UPN or object entry you provided to retrieve the details. Please make sure to check the tenant you have signed in while retrieving the details. Please use the following document to query the Microsoft Graph API: Get a user
403 Forbidden Access is denied to the requested resource. This comes when there is no proper permission provided while retrieving the details. You can refer the permissions and documents provided to overcome the issue.
501 Not Implemented The requested feature isn’t implemented. This comes when the requested query or method might have correctly provided. If the query is not in proper format or the information requested is not yet supported from Graph API.
If you would like to retrieve the information using Graph API using Application, you can configure an application Microsoft Entra ID and provide the necessary permissions and use the client ID and secret to retrieve the information.
In order to register an application, please follow this document: Register an application
Under API permissions, you need to configure the required permissions taking the reference document: Microsoft Graph permissions reference.
You can retrieve the token using client credential flow using the following document: Microsoft identity platform and the OAuth 2.0 client credentials flow.
Note: If you are using on behalf of flow, application itself should have the required permissions to retrieve the details. That means you need to add only application permissions to the application to retrieve the information.
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If the answer is helpful, please click "Accept Answer" and kindly "upvote it". If you have extra questions about this answer, please click "Comment".