This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
TheMicrosoft Graph API now supports Microsoft Intune with specific APIs and permission roles. The Microsoft Graph API uses Microsoft Entra ID for authentication and access control.Access to the Intune APIs in Microsoft Graph requires:
An application ID with:
User credentials with:
The end user to grant permission to the app to perform applications tasks for their Azure tenant.
This article:
Shows how to register an application with access to the Microsoft Graph API and relevant permission roles.
Describes the Intune API permission roles.
Provides Intune API authentication examples for C# and PowerShell.
Describes how to support multiple tenants.
To learn more, see:
To register an app to use Microsoft Graph API:
Sign in to theMicrosoft Entra admin center using administrative credentials.
As appropriate, you may use:
In the admin center, expandIdentity >Applications, and then selectApp registrations.

Either chooseNew registration to create a new application or choose an existing application. (If you choose an existing application, skip the next step.)
In theRegister an application pane, specify the following:
AName for the application (displayed when users sign in).
TheSupported account type.
ARedirect URI value.This value is optional.
Note
Azure AD Graph API is in its retirement phase. For more information, seeUpdate your applications to use Microsoft Authentication Library (MSAL) and Microsoft Graph API.

To learn more, seeAuthentication Scenarios for Microsoft Entra ID.
SelectRegister to add your new application.
By selectingRegister, you agree to theMicrosoft Platform Policies.
From the application pane for your app:
Note theApplication (client) ID value.
Then, from the navigation menu, selectAPI permissions.
From theAPI permissions pane:
SelectAdd a permission, and then on theMicrosoft APIs tab, select theMicrosoft Graph tile.
Select theApplication permissions option to show all of the available permissions, and then select the type of permissions your application requires.
Choose the roles required for your app by placing a checkmark to the left of the relevant names. To learn about specific Intune permission scopes, seeIntune permission scopes. To learn about other Graph API permission scopes, seeMicrosoft Graph permissions reference.
For best results, choose the fewest roles needed to implement your application.
When you add an application through the Microsoft Entra admin center, you can choose the Intune API permissions based on the requirements of your application.
The following Intune API permissions are available when adding an application through the Microsoft Entra admin center:
If you are a partner interested in integrating with Intune using these API permissions, contact theMicrosoft Intelligent Security Association] team for information.
When finished, chooseAdd permissions to save your changes.
At this point, you may also:
Choose to grant permission for all tenant accounts to use the app without providing credentials.
To do so, you can grant permissions and accept the confirmation prompt.
When you run the application for the first time, you're prompted to grant the app permission to perform the selected roles.
Make the app available to users outside your tenant. (This is typically only required for partners supporting multiple tenants/organizations.)
To do so:
ChooseManifest from the application pane.

Change the value of theavailableToOtherTenants setting totrue.
Save your changes.
If you receive a large amount of data while requesting your app listing when using Graph API, you may encounter a 503 Service Unavailable error. We recommended that you try again with a smaller page size, such as 20 or fewer elements.
Microsoft Entra ID and Microsoft Graph use permission scopes to control access to corporate resources.
Permission scopes (also called theOAuth scopes) control access to specific Intune entities and their properties. This section summarizes the permission scopes for Intune API features.
To learn more:
When you grant permission to Microsoft Graph, you can specify the following scopes to control access to Intune features:The following table summarizes the Intune API permission scopes. The first column shows the name of the feature as displayed in theMicrosoft Intune admin center and the second column provides the permission scope name.
| Enable Access setting | Scope name |
|---|---|
| Perform user-impacting remote actions on Microsoft Intune devices | DeviceManagementManagedDevices.PrivilegedOperations.All |
| Read and write Microsoft Intune devices | DeviceManagementManagedDevices.ReadWrite.All |
| Read Microsoft Intune devices | DeviceManagementManagedDevices.Read.All |
| Read and write Microsoft Intune RBAC settings | DeviceManagementRBAC.ReadWrite.All |
| Read Microsoft Intune RBAC settings | DeviceManagementRBAC.Read.All |
| Read Microsoft Intune scripts | DeviceManagementScripts.Read.All |
| Read and write Microsoft Intune scripts | DeviceManagementScripts.ReadWrite.All |
| Read and write Microsoft Intune apps | DeviceManagementApps.ReadWrite.All |
| Read Microsoft Intune apps | DeviceManagementApps.Read.All |
| Read and write Microsoft Intune Device Configuration and Policies | DeviceManagementConfiguration.ReadWrite.All |
| Read Microsoft Intune Device Configuration and Policies | DeviceManagementConfiguration.Read.All |
| Read and write Microsoft Intune configuration | DeviceManagementServiceConfig.ReadWrite.All |
| Read Microsoft Intune configuration | DeviceManagementServiceConfig.Read.All |
The table lists the settings as they appear in theMicrosoft Intune admin center. The following sections describe the scopes in alphabetical order.
At this time, all Intune permission scopes require administrator access. This means you need corresponding credentials when running apps or scripts that access Intune API resources.
Enable Access setting:Read Microsoft Intune apps
Permits read access to the following entity properties and status:
Enable Access setting:Read and write Microsoft Intune apps
Allows the same operations asDeviceManagementApps.Read.All
Also permits changes to the following entities:
Enable Access setting:Read Microsoft Intune device configuration and policies
Permits read access to the following entity properties and status:
Note
As of July 31, 2025, Microsoft Graph replaced use of theDeviceManagementConfiguration.Read.All permission withDeviceManagementScripts.ReadWrite.All for the following API calls:
Enable Access setting:Read and write Microsoft Intune device configuration and policies
Allows the same operations asDeviceManagementConfiguration.Read.All
Apps can also create, assign, delete, and change the following entities:
Note
As of July 31, 2025, Microsoft Graph replaced use of theDeviceManagementConfiguration.ReadWrite.All permission withDeviceManagementScripts.ReadWrite.All for the following API calls:
Enable Access setting:Perform user-impacting remote actions on Microsoft Intune devices
Permits the following remote actions on a managed device:
Enable Access setting:Read Microsoft Intune devices
Permits read access to the following entity properties and status:
Enable Access setting:Read and write Microsoft Intune devices
Allows the same operations asDeviceManagementManagedDevices.Read.All
Apps can also create, delete, and change the following entities:
The following remote actions are also allowed:
Enable Access setting:Read Microsoft Intune RBAC settings
Permits read access to the following entity properties and status:
Enable Access setting:Read and write Microsoft Intune RBAC settings
Allows the same operations asDeviceManagementRBAC.Read.All
Apps can also create, assign, delete, and change the following entities:
Enable Access setting:Read Microsoft Intune scripts
Apps can view (read) a script, specifically:
Enable Access setting:Read and write Microsoft Intune scripts
Allows the same operations asDeviceManagementScripts.Read.All
Apps can create, update or delete a script, specifically:
Enable Access setting:Read Microsoft Intune configuration
Permits read access to the following entity properties and status:
Enable Access setting:Read and write Microsoft Intune configuration
Allows the same operations as DeviceManagementServiceConfig.Read.All_
Apps can also configure the following Intune features:
This section shows how to incorporate Microsoft Entra ID into your C# and PowerShell projects.
In each example, you'll need to specify an application ID that has at least theDeviceManagementManagedDevices.Read.All permission scope (discussed earlier).
When testing either example, you may receive HTTP status 403 (Forbidden) errors similar to the following:
{ "error": { "code": "Forbidden", "message": "Application is not authorized to perform this operation - Operation ID " + "(for customer support): 00000000-0000-0000-0000-000000000000 - " + "Activity ID: cc7fa3b3-bb25-420b-bfb2-1498e598ba43 - " + "Url: https://example.manage.microsoft.com/" + "Service/Resource/RESTendpoint?" + "api-version=2017-03-06 - CustomApiErrorPhrase: ", "innerError": { "request-id": "00000000-0000-0000-0000-000000000000", "date": "1980-01-0112:00:00" } }}If this happens, verify that:
You've updated the application ID to one authorized to use the Microsoft Graph API and theDeviceManagementManagedDevices.Read.All permission scope.
Your tenant credentials support administrative functions.
Your code is similar to the displayed samples.
This example shows how to use C# to retrieve a list of devices associated with your Intune account.
Note
Azure AD Graph API is in its retirement phase. For more information, seeUpdate your applications to use Microsoft Authentication Library (MSAL) and Microsoft Graph API.
Start Visual Studio and then create a new Visual C# Console app (.NET Framework) project.
Enter a name for your project and provide other details as desired.

Use the Solution Explorer to add the Microsoft MSAL NuGet package to the project:
Microsoft.Identity.Client and then chooseInstall.Add the following statements to the top ofProgram.cs:
using Microsoft.Identity.Client;using System.Net.Http;Add a method to create the authorization header:
private static async Task<string> GetAuthorizationHeader(){ string applicationId = "<Your Application ID>"; string authority = "https://login.microsoftonline.com/common/"; Uri redirectUri = new Uri("urn:ietf:wg:oauth:2.0:oob"); AuthenticationContext context = new AuthenticationContext(authority); AuthenticationResult result = await context.AcquireTokenAsync( "https://graph.microsoft.com", applicationId, redirectUri, new PlatformParameters(PromptBehavior.Auto)); return result.CreateAuthorizationHeader();Remember to change the value ofapplication_ID to match one granted at least theDeviceManagementManagedDevices.Read.All permission scope, as described earlier.
Add a method to retrieve the list of devices:
private static async Task<string> GetMyManagedDevices(){ string authHeader = await GetAuthorizationHeader(); HttpClient graphClient = new HttpClient(); graphClient.DefaultRequestHeaders.Add("Authorization", authHeader); return await graphClient.GetStringAsync( "https://graph.microsoft.com/beta/me/managedDevices");}UpdateMain to callGetMyManagedDevices:
string devices = GetMyManagedDevices().GetAwaiter().GetResult();Console.WriteLine(devices);Compile and run your program.
When you first run your program, you should receive two prompts. The first requests your credentials and the second grants permissions for themanagedDevices request.
For reference, here's the completed program:
using Microsoft.Identity.Client;using System;using System.Net.Http;using System.Threading.Tasks;namespace IntuneGraphExample{ class Program { static void Main(string[] args) { string devices = GetMyManagedDevices().GetAwaiter().GetResult(); Console.WriteLine(devices); } private static async Task<string> GetAuthorizationHeader() { string applicationId = "<Your Application ID>"; string authority = "https://login.microsoftonline.com/common/"; Uri redirectUri = new Uri("urn:ietf:wg:oauth:2.0:oob"); AuthenticationContext context = new AuthenticationContext(authority); AuthenticationResult result = await context.AcquireTokenAsync("https://graph.microsoft.com", applicationId, redirectUri, new PlatformParameters(PromptBehavior.Auto)); return result.CreateAuthorizationHeader(); } private static async Task<string> GetMyManagedDevices() { string authHeader = await GetAuthorizationHeader(); HttpClient graphClient = new HttpClient(); graphClient.DefaultRequestHeaders.Add("Authorization", authHeader); return await graphClient.GetStringAsync("https://graph.microsoft.com/beta/me/managedDevices"); } }}PowerShell scripts can use the Microsoft Graph PowerShell module for authentication. To learn more, seeMicrosoft Graph PowerShell and theIntune PowerShell examples.
If your organization supports organizations with their own Microsoft Entra tenants, you may want to permit your clients to use your application with their respective tenants.
To do so:
Verify that the client account exists in the target Microsoft Entra tenant.
Verify that your tenant account allows users to register applications (seeUser settings).
Establish a relationship between each tenant.
To do so, either:
a. Use theMicrosoft Partner Center to define a relationship with your client and their email address.
b. Invite the user to become a guest of your tenant.
To invite the user to be a guest of your tenant:
ChooseAdd a guest user from theQuick tasks panel.

Enter the client's email address and (optionally) add a personalized message for the invite.

ChooseInvite.
This sends an invite to the user.

The user needs to choose theGet Started link to accept your invitation.
When the relationship is established (or your invitation has been accepted), add the user account to theDirectory role.
Remember to add the user to other roles as needed. For example, to allow the user to manage Intune settings, they need to be at least anIntune Service administrator.
Also:
Usehttps://admin.microsoft.com to assign an Intune license to your user account.
Update application code to authenticate to the client's Microsoft Entra tenant domain, rather than your own.
For example, suppose your tenant domain iscontosopartner.onmicrosoft.com and your client's tenant domain isnorthwind.onmicrosoft.com, you would update your code to authenticate to your client's tenant.
To do so in a C# application based on the earlier example, you'd change the value of theauthority variable:
string authority = "https://login.microsoftonline.com/common/";to
string authority = "https://login.microsoftonline.com/northwind.onmicrosoft.com/";Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?