Microsoft Graph is like a gateway to the data and insights in Office 365. This exposes APIs and libraries to access data from Office 365 services, Azure active directories, etc. It connects all the services available using relationships on which we can get valuable insight into the data from the Microsoft Graph API. Microsoft Graph is a RESTful web API that enables you to access Microsoft Cloud service resources. After you register your app and get authentication tokens for a user or service, you can make requests to the Microsoft Graph API. In this blog, we will feature briefly on how we can connect to Graph API and fetch Office 365 Users list from Azure Data Factory using examples.
Building a pipeline to fetch O365 Users
1) Create a new pipeline and drag a web activity which will fetch us the access token to get authorized to hit the graph API.
2) Configure the web activity by providing the following details:
- URL
- Method
- Headers
- Body

3. Drag a copy activity and configure the source and sink datasets with necessary parameters. Source dataset will be a REST API which will have one parameter for holding the access token.

4. Mention the expression for parameter which will hold the access token generated by the web activity.

Sink dataset will be AzureDataLake file (here we are having JSON formatted file as a sink)

5. Validate and trigger the pipeline.
Following the above steps, your pipeline looks like the one in the below image.


The output file will look like below

Thus, we have a list of Office 365 users and their details in the Users.json file fetched from graph API using Azure Data Factory.
Read more blogs on Microsoft click here to know more on Visual BI Solutions Self Service offerings click here.