You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-5Lines changed: 36 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ School data is kept in sync in O365 Education tenants by [Microsoft School Data
8
8
9
9
-[Sample Goals](#sample-goals)
10
10
-[Prerequisites](#prerequisites)
11
+
-[Generate a self-signed certificate](generate-a-self-signed-certificate)
11
12
-[Register the application in Azure Active Directory](#register-the-application-in-azure-active-directory)
12
13
-[Run the sample locally](#run-the-sample-locally)
13
14
-[Deploy the sample to Azure](#deploy-the-sample-to-azure)
@@ -31,6 +32,7 @@ The sample demonstrates:
31
32
- Getting schools, classes, teachers, and students from Office 365 Education:
32
33
33
34
-[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.
34
36
35
37
This sample is implemented with the Python language and [Django](https://www.djangoproject.com/) web framework.
36
38
@@ -350,18 +352,19 @@ O365 users authentication is implemented with Open ID Connect.
350
352
351
353
**Data Access**
352
354
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.
| auth_user | Django built-in user table which contains users' authentication information: username, email, password... |
360
362
| user_roles | Contains users' roles. Three roles are used in this sample: admin, teacher, and student. |
361
363
| 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. |
362
364
| 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. |
365
368
366
369
Models are defined in **/models/db.py**.
367
370
@@ -419,6 +422,12 @@ Users from any Azure Active Directory tenant can access this app. Some permissio
419
422
420
423
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/).
421
424
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
+
422
431
### Office 365 Education API
423
432
424
433
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.
488
497
489
498

490
499
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:
@@ -514,6 +533,18 @@ This flow is implemented in the AdminController.
514
533
515
534

516
535
536
+
**Application Authentication Flow**
537
+
538
+
This flow in implemented in the SyncData WebJob.
539
+
540
+

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
+
517
548
### Two Kinds of Graph APIs
518
549
519
550
There are two distinct Graph APIs used in this sample:
0 commit comments