0
votes

Does Azure AD Graph API support batch processing on users? As an example, if I want to update the location for several hundred users in my organization, is there any way I can do that? The only information I could find was what is described here: https://msdn.microsoft.com/en-us/library/azure/ad/graph/howto/azure-ad-graph-api-batch-processing

But as I understand, you can only batch operations on a single user entity in a given batch operation, and even that is limited to 5 operations per changeset. So my only option seems to be to sequentially invoke the API to update every single user in my list. I couldn't find any officially documented rate limiting that may be enforced by Microsoft. So I'm not sure if that approach would even work. Is there a better way to do this?

1

1 Answers

1
votes

Yes , Azure AD Graph API support batch processing on users . Please refer to this code sample , check the CreateUsersTest function in that code sample . To make that sample work , you need to add Read and write directory data app permission for your client app :

enter image description here

Another way is to use powershell to add multiple users using a bulk import process:

  1. first create a csv file with appropriate attributes like :

    enter image description here

  2. Then you could install Azure ActiveDirectory Powershell (MSOnline).

  3. Connect the service :

    PS C:\WINDOWS\system32> connect-msolservice
    
  4. Import users from csv file :

    $users = Import-Csv E:\a.csv
    
  5. Create users with New-MsolUser command .

    $users | ForEach-Object {New-MsolUser -UserPrincipalName $_.UserName -FirstName $_.FirstName -LastName $_.LastName –DisplayName $_.DisplayName -Title $_.JobTitle -Department $_.Department -Country $_.Country}
    

Update :

Please refer to document : https://msdn.microsoft.com/en-us/library/azure/ad/graph/howto/azure-ad-graph-api-batch-processing

The Graph API supports a subset of the functionality defined by the OData specification:

A single batch can contain a maximum of five queries and/or change sets combined.

A change set can contain a maximum of one source object modification and up to 20 add-link and delete-link operations combined. All operations in the change set must be on a single source entity.

In your scenario ,a single source entity means one user entity , you could create a user , modify that user in a change set , but can't create two users in one change set, since they're two entities .

It seems there is no such document lists rate limiting for batch process , but i have tested create 2000+ users with above code and it works fine .