Microsoft Graph API Documentation
repository·main·Indexed 40 days ago
https://github.com/microsoftgraph/microsoft-graph-docs-contribTechnical guides, API references, and tutorials for the Microsoft Graph API, including detailed documentation on managing application objects, updating application logos, and instantiating applications from templates using the beta endpoint.
What's inside Microsoft Graph
- While this repository contains the source for Microsoft Graph documentation, for the best viewing experience, it is recommended to use the official Microsoft Learn platform.
Provide feedback on Microsoft Graph documentation
mainYou can provide feedback or suggest improvements to the documentation through several channels:
- Report issues or questions: Use the standard feedback experience on the Microsoft Learn site.
- Propose direct changes: You can fork the repository, apply fixes, and submit a pull request following the CONTRIBUTING.md guidelines.
- Share ideas and programming experience: Post suggestions regarding future versions, code samples, and general developer experience at the Microsoft 365 Developer Platform Tech Community.
List groups using Microsoft Graph API
mainUse the
GET /groupsendpoint to list all groups available in an organization, excluding dynamic distribution groups.Important Considerations:
- Default Properties: By default, the API returns only a subset of commonly used properties. To retrieve additional properties, use a
GEToperation on a specific group with a$selectOData query option. Note thathasMembersWithLicenseErrorsandisArchivedcannot be retrieved via$select. - Eventual Consistency: Recently created, updated, or deleted groups might not appear in results immediately due to replication delays.
- Pagination: The default page size is 100, and the maximum is 999 group objects.
$skipis not supported for pagination. - Advanced Queries: Certain queries (like specific
$filterpatterns or$search) require theConsistencyLevel: eventualrequest header and the$count=truequery parameter.
GET https://graph.microsoft.com/beta/groups- Default Properties: By default, the API returns only a subset of commonly used properties. To retrieve additional properties, use a
Convert a single-tenant application to limited multitenant
mainTo convert an application from single-tenant (
AzureADMyOrg) to multitenant (AzureADMultipleOrgs) while restricting access to specific tenants, update thesignInAudienceand providesignInAudienceRestrictionsin a single request.Use the
@odata.type#microsoft.graph.allowedTenantsAudienceto define the restrictions and specify theallowedTenantIds.PATCH https://graph.microsoft.com/beta/applications/{id} Content-type: application/json { "signInAudience": "AzureADMultipleOrgs", "signInAudienceRestrictions": { "@odata.type": "#microsoft.graph.allowedTenantsAudience", "isHomeTenantAllowed": true, "allowedTenantIds": [ "818ce016-78c2-457c-91d7-c02c2faaa5fe", "c62670b0-53a1-4a38-b26c-4093cbaa510a" ] } }Convert a restricted multitenant application to single-tenant
mainTo revert a multitenant application back to single-tenant (
AzureADMyOrg), update thesignInAudienceand simultaneously removesignInAudienceRestrictionsby setting its type to#microsoft.graph.unrestrictedAudience.Best Practice: Perform these updates in a single request to avoid a period where the application is multitenant without restrictions, which may violate organizational policies.
PATCH https://graph.microsoft.com/beta/applications/{id} Content-type: application/json { "signInAudience": "AzureADMyOrg", "signInAudienceRestrictions": { "@odata.type": "#microsoft.graph.unrestrictedAudience" } }Update appRoles for an application
mainYou can update the
appRolescollection for an application.Important: The
appRolescollection is a replacement operation. To keep any existing app roles, you must include them in your request. Any existing objects in the collection that are not included in the request will be replaced by the new objects provided. This collection is synchronized with the corresponding property of the service principal in the tenant.PATCH https://graph.microsoft.com/beta/applications/fda284b5-f0ad-4763-8289-31a273fca865 Content-type: application/json { "appRoles": [ { "allowedMemberTypes": [ "User", "Application" ], "description": "Survey.Read", "displayName": "Survey.Read", "id": "ebb7c86c-fb47-4e3f-8191-420ff1b9de4a", "isEnabled": false, "origin": "Application", "value": "Survey.Read" } ] }Naming convention for redirect files
mainRedirect files in this repository must follow a specific naming pattern based on the month and year they were created. This pattern is used to manage the lifecycle of redirects, as files are automatically deleted after one year based on the date in their filename.
Pattern:
.openpublishing.redirection.<year>-<month>.jsonRules:
- Use the current month and year when creating a new file.
- Do not add new redirects to an existing file that does not match the current month/year.
- If no file exists for the current month/year, create a new one following the pattern.
.openpublishing.redirection.2023-10.jsonPerform an external admin takeover of an unmanaged domain
mainIf a domain is currently linked to an unmanaged tenant but you own the domain, you can use the
forceTakeoverparameter to take over that domain.Requirements:
- The domain must be unmanaged.
- The tenant must have already verified ownership of the domain by adding the required TXT records to the domain registrar.
Request Body Parameter:
forceTakeover(Boolean, optional): Set totrueto attempt a takeover. Defaults tofalse.
POST https://graph.microsoft.com/beta/domains/contoso.com/verify { "forceTakeover": true }Handle errors when setting up an educationAssignment resources folder
mainWhen calling
setUpResourcesFolder, you may encounter a400 Bad requestif the resource folder has already been initialized for that assignment.Error Details:
- HTTP Status:
400 Bad request - Error Code:
badRequest - Inner Error Code:
folderAlreadyExists - Message:
Resource folder already exists and has previously been set up.
{ "error": { "code": "badRequest", "message": "Bad request.", "innerError": { "code": "folderAlreadyExists", "message": "Resource folder already exists and has previously been set up." } } }- HTTP Status:
Example: Update win32LobAppInstallPowerShellScript
mainThis example demonstrates a
PATCHrequest to update the display name, content, state, signature enforcement, and bitness of a Win32 LOB app install PowerShell script.PATCH https://graph.microsoft.com/beta/deviceAppManagement/mobileApps/{mobileAppId}/contentVersions/{mobileAppContentId}/scripts/{mobileAppContentScriptId} Content-type: application/json Content-length: 233 { "@odata.type": "#microsoft.graph.win32LobAppInstallPowerShellScript", "displayName": "Display Name value", "content": "Content value", "state": "commitSuccess", "enforceSignatureCheck": true, "runAs32Bit": true }Example: Update windows10EnrollmentCompletionPageConfiguration
mainThis example demonstrates a
PATCHrequest to update various enrollment completion page settings, including installation progress visibility, error messaging, and timeout settings.PATCH https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations/{deviceEnrollmentConfigurationId} Content-type: application/json Content-length: 873 { "@odata.type": "#microsoft.graph.windows10EnrollmentCompletionPageConfiguration", "displayName": "Display Name value", "description": "Description value", "priority": 8, "version": 7, "roleScopeTagIds": [ "Role Scope Tag Ids value" ], "deviceEnrollmentConfigurationType": "limit", "showInstallationProgress": true, "blockDeviceSetupRetryByUser": true, "allowDeviceResetOnInstallFailure": true, "allowLogCollectionOnInstallFailure": true, "customErrorMessage": "Custom Error Message value", "installProgressTimeoutInMinutes": 15, "allowDeviceUseOnInstallFailure": true, "selectedMobileAppIds": [ "Selected Mobile App Ids value" ], "allowNonBlockingAppInstallation": true, "installQualityUpdates": true, "trackInstallProgressForAutopilotOnly": true, "disableUserStatusTrackingAfterFirstUser": true }Example: Configure agent via HTTP POST
mainThis example demonstrates how to configure an RMM agent by providing the agent URL, SHA256 hash, installation parameters, and enabling automatic deployment.
POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/externalPartners/b3548526-e615-3785-3118-be70b3968ec5/configureAgent Content-Type: application/json { "agentSetting": { "agentUrl": "https://rmmExample.microsoft.com/agent/rmmExampleAgent.msi", "agentSha256": "EC6AF1EA0367D16DDE6639A89A080A524CEBC4D4BEDFE00ED0CAC4B865A918D8", "installParameters": [ "/quiet", "/norestart", "TOKENID=e69c1577-d465-4e57-af33-0ddea43feeb1" ], "autoDeploymentEnabled": true } }