Back

Microsoft Intune API Essential Guide

Aug 8, 20246 minute read

What type of API does Microsoft Intune provide?

API Type

  • Microsoft Intune uses a REST API that is part of the Microsoft Graph API.

Key Features

  • The Intune API in Microsoft Graph allows you to:

    • Access Intune device and application information
    • Manage devices and apps
    • Automate Intune tasks
    • Configure Intune settings
  • It supports both delegated permissions and application permissions for read and write operations.

  • The API endpoint for Intune is: https://graph.microsoft.com/v1.0/ (for v1.0) https://graph.microsoft.com/beta/ (for beta version)

Using the API

  • You need to use Azure AD to authenticate and access the Intune API.

  • Permissions need to be specified to access Intune resources, typically done in the Azure Active Directory portal.

  • The API uses standard REST conventions, with HTTP methods like GET, POST, PATCH, DELETE etc.

  • Data is exchanged in JSON format.

Available Reports

  • Many Intune reports can be exported using the Graph API endpoint: https://graph.microsoft.com/beta/deviceManagement/reports/exportJobs

  • Reports include device compliance, app installation status, discovered apps, and many others.

Best Practices

  • Use the official Microsoft Graph documentation and SDKs when working with the Intune API.

  • Be aware of versioning (v1.0 vs beta) and use the appropriate endpoint for your needs.

  • Properly handle authentication and implement error handling in your API calls.

Does the Microsoft Intune API have webhooks?

Official Microsoft Intune API Webhooks

The official Microsoft Intune API does not have direct webhook support for device or app changes. However, there are alternative methods to receive notifications and track changes in Intune.

Alternative Methods for Notifications

  1. Audit Logs:

    • You can use audit logs to track and monitor events in Microsoft Intune.
    • Microsoft provides documentation on how to use audit logs for this purpose.
  2. Azure Monitor:

    • There's a preview feature that allows you to send log data to storage, event hubs, or log analytics in Intune.
    • This can be used to review logs using Azure Monitor.
  3. Third-Party Solutions:

    • Some third-party solutions, like Eido (www.eido.cloud), offer integrations that can send Intune notifications to platforms like Microsoft Teams.

Key Points to Consider

  1. No Native Webhooks: The official Intune API doesn't have a built-in webhook mechanism specifically for mobile devices and apps.

  2. Delay in Updates: When using alternative methods like audit logs, there might be a delay between when changes occur and when they are reflected in the logs.

  3. Azure Event Grid: While not specific to Intune, Azure Event Grid supports webhooks for various Azure services. This might be an option to explore for some Intune-related events if they are exposed through Azure services.

  4. Microsoft Graph API: Although not specific to Intune, Microsoft Graph API supports change notifications through webhooks for various Microsoft 365 services.

Best Practices

  1. Monitor Audit Logs: Regularly check Intune audit logs for device and app changes.

  2. Use Azure Monitor: Leverage Azure Monitor to centralize and analyze Intune log data.

  3. Consider Third-Party Tools: Evaluate third-party solutions that offer Intune integrations if real-time notifications are crucial.

  4. Explore Microsoft Graph API: If you need webhooks for other Microsoft 365 services, consider using Microsoft Graph API's change notifications feature.

  5. Stay Updated: Keep an eye on Microsoft's documentation and announcements, as they may introduce webhook support for Intune in the future.

While the official Microsoft Intune API doesn't currently offer webhooks for device or app changes, there are alternative methods to track and receive notifications about changes in your Intune environment. Depending on your specific needs, you may need to combine multiple approaches to achieve the desired level of monitoring and notification.

Rate Limits and other limitations

The Microsoft Intune API has several rate limits and throttling thresholds in place to ensure consistent availability and performance. Here are the key points regarding the API rate limits for Microsoft Intune:

General Intune Service Limits

For most Intune services, the following limits apply:

  • POST, PUT, DELETE, PATCH requests:

    • 200 requests per 20 seconds per tenant for all apps
    • 100 requests per 20 seconds per app per tenant
  • Any request type:

    • 2000 requests per 20 seconds per tenant for all apps
    • 1000 requests per 20 seconds per app per tenant

Intune Devices Service Limits

The Intune devices service has slightly higher limits:

  • POST, PUT, DELETE, PATCH requests:

    • 400 requests per 20 seconds per tenant for all apps
    • 200 requests per 20 seconds per app per tenant
  • Any request type:

    • 4000 requests per 20 seconds per tenant for all apps
    • 2000 requests per 20 seconds per app per tenant

Global Limits

In addition to the service-specific limits, there is a global limit that applies across all tenants:

  • Any request type: 130,000 requests per 10 seconds per app across all tenants

Key Points to Consider

  1. The limits are evaluated on a sliding window basis, typically over a 20-second period for Intune services.

  2. When a limit is exceeded, subsequent requests will receive a "429 Too Many Requests" error response.

  3. The limits are designed to protect the service from extraordinary demands that could threaten availability and performance.

  4. Different Intune services (e.g., enrollment, applications, device configuration) have their own specific limits, but most follow the general pattern described above.

  5. It's important to implement proper error handling and retry logic in applications that interact with the Intune API to handle potential throttling scenarios.

Best Practices

  1. Implement exponential backoff retry logic when encountering 429 errors.

  2. Optimize API calls to reduce the number of requests where possible.

  3. Consider caching frequently accessed data to reduce API calls.

  4. Spread out requests over time when performing bulk operations to avoid hitting rate limits.

By adhering to these rate limits and implementing proper handling, developers can ensure their applications interact with the Microsoft Intune API in a way that maintains service stability and performance for all users.

Latest API Version

The most recent version of the Microsoft Intune API is the Microsoft Graph API v1.0 for Intune. Here are the key points:

Current API Version

  • The current production version of the Intune API is available through Microsoft Graph v1.0.

  • There is also a beta version of the Intune API available through Microsoft Graph beta.

API Overview

  • The Intune API in Microsoft Graph allows you to access Intune device and application information, manage devices, manage apps, and automate Intune.

  • It enables programmatic access to Intune information for your tenant and performs the same Intune operations as those available through the Azure Portal.

Key Considerations

  • Using the Microsoft Graph APIs to configure Intune controls and policies requires that the Intune service is correctly licensed by the customer.

  • For mobile device management (MDM) scenarios, the Microsoft Graph API for Intune supports standalone deployments; Intune hybrid deployments are not supported.

  • The API endpoint for Intune reports is: https://graph.microsoft.com/beta/deviceManagement/reports/exportJobs.

Best Practices

  • Use Azure AD to authenticate and access the Microsoft Graph API for Intune.

  • Explore the PowerShell Intune samples to see how to use the Microsoft Graph API for Intune in working examples.

  • When exporting Intune reports, use the appropriate reportName parameter values listed in the documentation to specify which report you want to export.

In summary, the most up-to-date and recommended version of the Microsoft Intune API is accessed through Microsoft Graph v1.0, with a beta version also available for testing new features. This API provides comprehensive access to Intune functionality and data, allowing for powerful integration and automation capabilities.

How to get a Microsoft Intune developer account and API Keys?

To get a developer account for Microsoft Intune to create an API integration, you need to follow these steps:

Register an application with Microsoft Entra ID

  1. Sign in to the Microsoft Intune admin center using administrative credentials.

  2. Navigate to "All services" > "M365 Microsoft Entra ID" > "Microsoft Entra ID" > "App registrations".

  3. Choose "New registration" to create a new application.

  4. In the "Register an application" pane, specify the following:

    • A name for the application
    • The supported account type
    • A redirect URI value (optional)

Grant API permissions

  1. After registering the application, you need to grant it access to the Microsoft Intune API.

  2. Select your newly registered app in the "App registrations" pane.

  3. Find and select the "Microsoft Intune API".

  4. Select "Delegated Permissions" and check the box for "Get data warehouse information from Microsoft Intune".

  5. Optionally, select "Grant admin consent for Microsoft" to grant access to all accounts in the current directory.

Generate client secret

  1. Select "Certificates & secrets" > "+ New client secret" and generate a new secret.

  2. Make sure to copy and store the secret safely, as you won't be able to access it again.

What can you do with the Microsoft Intune API?

Based on the search results provided, here are the key data models you can interact with using the Microsoft Intune API:

Device Management

  • Managed Devices
    • Allows querying and managing enrolled devices
    • Can retrieve device properties like OS version, compliance state, etc.
    • Supports filtering and selecting specific device attributes [4]

Application Management

  • Managed Apps
    • Enables managing and querying mobile apps deployed through Intune

Configuration Management

  • Device Configurations
    • Allows creating and managing device configuration profiles

Compliance Management

  • Device Compliance Policies
    • Enables setting up and managing compliance policies

Enrollment Management

  • Enrollment Configurations
    • Supports managing enrollment settings and restrictions

Reporting

  • Intune Data Warehouse API
    • Provides access to reporting data
    • Uses OData protocol
    • Allows querying entities like devices, users, app installs, etc.

User Management

  • Users
    • Enables querying Intune-managed users

Group Management

  • Groups
    • Allows managing Intune device and user groups

Policy Sets

  • Policy Sets
    • Enables creating and managing policy sets that combine multiple policies

Role-Based Access Control

  • Role Assignments
    • Supports managing Intune admin roles and permissions

Key points to consider:

  • The API uses OAuth 2.0 for authentication
  • Both v1.0 and beta versions of the API are available
  • Some properties may have limitations on filtering capabilities
  • PowerShell cmdlets are available for easier interaction with the API

The API allows performing most operations available in the Intune portal programmatically, enabling automation and integration scenarios. However, some limitations may exist around filtering and property selection for certain entities.