Skip to content

Commit 81874a0

Browse files
committed
Update README.md
1 parent b7a3fe1 commit 81874a0

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ School data is kept in sync in O365 Education tenants by [Microsoft School Data
88

99
- [Sample Goals](#sample-goals)
1010
- [Prerequisites](#prerequisites)
11+
- [Generate a self-signed certificate](generate-a-self-signed-certificate)
1112
- [Register the application in Azure Active Directory](#register-the-application-in-azure-active-directory)
1213
- [Run the sample locally](#run-the-sample-locally)
1314
- [Deploy the sample to Azure](#deploy-the-sample-to-azure)
@@ -31,6 +32,7 @@ The sample demonstrates:
3132
- Getting schools, classes, teachers, and students from Office 365 Education:
3233

3334
- [Office 365 Schools REST API reference](https://msdn.microsoft.com/office/office365/api/school-rest-operations)
35+
- A [Differential Query](https://msdn.microsoft.com/en-us/library/azure/ad/graph/howto/azure-ad-graph-api-differential-query) is used to sync data that is cached in a local database by the SyncData Web Job.
3436

3537
This sample is implemented with the Python language and [Django](https://www.djangoproject.com/) web framework.
3638

@@ -350,18 +352,19 @@ O365 users authentication is implemented with Open ID Connect.
350352

351353
**Data Access**
352354

353-
In this sample, [Django's built-in ORM](https://docs.djangoproject.com/en/1.11/topics/db/) is used to access data from the backend SQLite database.
355+
In this sample, [Django's built-in ORM](https://docs.djangoproject.com/en/1.11/topics/db/) is used to access data from the backend MySQL database.
354356

355357
Below are the tables:
356358

357-
| Table | Description |
358-
| ------------------------------ | ---------------------------------------- |
359+
| Table | Description |
360+
| ------------------------------ | ------------------------------------------------------------ |
359361
| auth_user | Django built-in user table which contains users' authentication information: username, email, password... |
360362
| user_roles | Contains users' roles. Three roles are used in this sample: admin, teacher, and student. |
361363
| profiles | Contains users' extra information: *favoriteColor*, *organization_id*, *o365UserId*, and *o365Email*. The later two are used to connect the local user with an O365 user. |
362364
| organizations | A row in this table represents a tenant in AAD.<br>*isAdminConsented* column records if the tenant consented by an administrator. |
363-
| token_cache | Contains the users' access/refresh tokens. |
364-
| classroom_seating_arrangements | Contains the classroom seating arrangements data. |
365+
| token_cache | Contains the users' access/refresh tokens. |
366+
| classroom_seating_arrangements | Contains the classroom seating arrangements data. |
367+
| data_sync_records | Stores data sync records like the delta link. |
365368

366369
Models are defined in **/models/db.py**.
367370

@@ -419,6 +422,12 @@ Users from any Azure Active Directory tenant can access this app. Some permissio
419422

420423
For more information, see [Build a multi-tenant SaaS web application using Azure AD & OpenID Connect](https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-multitenant-openidconnect/).
421424

425+
**SyncData WebJob**
426+
427+
The sync data WebJob is a standalone Python app. It is located in `/webjobs/sync_data` folder and will be deployed to `/App_Data/jobs/triggered/` folder of the Web App after the deployemnt.
428+
429+
This app was created to demonstrate differential query. Please check [Differential query](differential-query) section for more details.
430+
422431
### Office 365 Education API
423432

424433
The [Office 365 Education APIs](https://msdn.microsoft.com/office/office365/api/school-rest-operations) return data from any Office 365 tenant which has been synced to the cloud by Microsoft School Data Sync. The APIs provide information about schools, classes, teachers, students, and rosters. The Schools REST API provides access to school entities in Office 365 for Education tenants.
@@ -488,6 +497,16 @@ Below are some screenshots of the sample app that show the education data.
488497

489498
![](Images/edu-class.png)
490499

500+
### Differential Query
501+
502+
A [differential query](https://msdn.microsoft.com/en-us/Library/Azure/Ad/Graph/howto/azure-ad-graph-api-differential-query) request returns all changes made to specified entities during the time between two consecutive requests. For example, if you make a differential query request an hour after the previous differential query request, only the changes made during that hour will be returned. This functionality is especially useful when synchronizing tenant directory data with an application’s data store.
503+
504+
The related code is in `/webjobs/sync_data/user_data_sync_service.py`.
505+
506+
Below is the log generated by the SyncData WebJob:
507+
508+
[![img](https://github.com/TylerLu/EDUGraphAPI/raw/master/Images/sync-data-web-job-log.png)](https://github.com/TylerLu/EDUGraphAPI/blob/master/Images/sync-data-web-job-log.png)
509+
491510
### Authentication Flows
492511

493512
There are 4 authentication flows in this project.
@@ -514,6 +533,18 @@ This flow is implemented in the AdminController.
514533

515534
![](Images/auth-flow-admin-login.png)
516535

536+
**Application Authentication Flow**
537+
538+
This flow in implemented in the SyncData WebJob.
539+
540+
![](Images/auth-flow-app-login.png)
541+
542+
An X509 certificate is used. For more details, please check the following links:
543+
544+
- [Daemon or Server Application to Web API](https://docs.microsoft.com/en-us/azure/active-directory/active-directory-authentication-scenarios#daemon-or-server-application-to-web-api)
545+
- [Authenticating to Azure AD in daemon apps with certificates](https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-daemon-certificate-credential/)
546+
- [Build service and daemon apps in Office 365](https://msdn.microsoft.com/en-us/office/office365/howto/building-service-apps-in-office-365)
547+
517548
### Two Kinds of Graph APIs
518549

519550
There are two distinct Graph APIs used in this sample:

0 commit comments

Comments
 (0)