Microsoft Graph API Documentation

repository·main·Indexed 40 days ago

https://github.com/microsoftgraph/microsoft-graph-docs-contrib

Technical 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.

Tokens
300.8K
Snippets
396
Records
627
Agent score
98%

What's inside Microsoft Graph

  1. Provide feedback on Microsoft Graph documentation

    main

    You can provide feedback or suggest improvements to the documentation through several channels:

  2. List groups using Microsoft Graph API

    main

    Use the GET /groups endpoint 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 GET operation on a specific group with a $select OData query option. Note that hasMembersWithLicenseErrors and isArchived cannot 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. $skip is not supported for pagination.
    • Advanced Queries: Certain queries (like specific $filter patterns or $search) require the ConsistencyLevel: eventual request header and the $count=true query parameter.
    GET https://graph.microsoft.com/beta/groups
  3. Convert a single-tenant application to limited multitenant

    main

    To convert an application from single-tenant (AzureADMyOrg) to multitenant (AzureADMultipleOrgs) while restricting access to specific tenants, update the signInAudience and provide signInAudienceRestrictions in a single request.

    Use the @odata.type #microsoft.graph.allowedTenantsAudience to define the restrictions and specify the allowedTenantIds.

    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"
        ]
      }
    }
  4. Convert a restricted multitenant application to single-tenant

    main

    To revert a multitenant application back to single-tenant (AzureADMyOrg), update the signInAudience and simultaneously remove signInAudienceRestrictions by 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"
      }
    }
  5. Update appRoles for an application

    main

    You can update the appRoles collection for an application.

    Important: The appRoles collection 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"
            }
        ]
    }
  6. Naming convention for redirect files

    main

    Redirect 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>.json

    Rules:

    • 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.json
  7. Perform an external admin takeover of an unmanaged domain

    main

    If a domain is currently linked to an unmanaged tenant but you own the domain, you can use the forceTakeover parameter 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 to true to attempt a takeover. Defaults to false.
    POST https://graph.microsoft.com/beta/domains/contoso.com/verify
    
    {
      "forceTakeover": true
    }
  8. Handle errors when setting up an educationAssignment resources folder

    main

    When calling setUpResourcesFolder, you may encounter a 400 Bad request if 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."
            }
        }
    }
  9. Example: Update win32LobAppInstallPowerShellScript

    main

    This example demonstrates a PATCH request 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
    }
  10. Example: Update windows10EnrollmentCompletionPageConfiguration

    main

    This example demonstrates a PATCH request 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
    }
  11. Example: Configure agent via HTTP POST

    main

    This 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
      }
    }