Microsoft Graph and Azure
Functions
Dragan Panjkov
Dragan Panjkov
www.github.com/panjkov
Agenda
• Introducing Microsoft Graph
• Azure Functions
• Using Microsoft Graph bindings in Azure Functions
• Featured scenarios
SITES
GROUPS
ME
CONVERSATIONS CONTENT
INSIGHTS
CONTACTS
PEOPLE
ORGANIZATION
TASKS
EMAIL
EVENTS
DOCUMENTS
DEVICES
CHATS
TEAMS
ACTIVITY
TRENDING
SHARED
REPORTS
Microsoft Graph
Microsoft Graph
Office 365 Platform
STANDALONE WEB AND
DEVICE APPS
 
Extensions
Embedded canvases
Users Groups Outlook OneNote more…SharePoint IntuneTeams Azure ADPlanner Excel
https://graph.microsoft.com
Your appOne endpoint
One token
All users
Microsoft Graph API
Access user, group and organizational data
Calling the API
• HTTP verbs dictate the request intent: GET | POST | PATCH | PUT | DELETE
• Version: /v1.0 or /beta
• Resource: /users, /groups, /sites, /drives, /devices, more…
• Member from collection: /users/AAA
• Property: /users/AAA/department
• Traverse to related resources via navigations: /users/AAA/events
• Query parameters: /users/AAA/events?$top=5
o Format results: $select | $orderby
o Control results: $filter | $expand
o Paging: $top | $skip | $skiptoken
/{version} ?{query-parameters}/{resource}/{id}/{property}
aka.ms/ge
SDKs, samples and tooling
Calling the Microsoft Graph
Microsoft
Graph
Auth
access_token
Register your app at https://apps.dev.microsoft.com
MSAL
YOUR APP
Microsoft
Graph
id_token
access_token refresh_token
Microsoft
Identity
App types and permissions
Users can consent for their data or admin can consent for all users Only admin can consent
App
permissions
User
permissions
App
permissions
Permission type: applicationPermission type: delegated
https://developer.microsoft.com/en-us/graph/docs/concepts/permissions_reference
Get access on behalf of users Get access as a service
Effective permissionEffective permission
What is Serverless?
Do more. Serverless.
Microsoft Graph + Azure Functions
Benefits of serverless
Access data in Microsoft Graph
Best in class security
Built on Azure App Service
Microsoft Graph bindings
• Auth token input
• Excel table input
• Excel table output
• OneDrive file input
• OneDrive file output
• Outlook message output
• Microsoft Graph webhook triggers and bindings
Microsoft Graph templates
Prerequisites
• Enable Functions 2.0 preview
• Install the extension
• Microsoft.Azure.WebJobs.Extensions.AuthTokens
• Microsoft.Azure.WebJobs.Extensions.MicrosoftGraph
• Configure Authentication / Authorization
Limitations
• Currently in beta
• Only C# and JavaScript are supported inside the portal
• Bugs
• Cannot subscribe to webhook if not anonymous
• Invalid Graph access token if using Client Credentials auth
demo
Resources
• Graph Explorer
www.aka.ms/ge
• Microsoft Graph bindings on Azure Functions documentation site
https://docs.microsoft.com/en-us/azure/azure-functions/functions-
bindings-microsoft-graph
• Announcement on beta release on Azure Functions blog
https://blogs.msdn.microsoft.com/appserviceteam/2017/09/25/my-intern-
project-microsoft-graph-bindings-for-azure-functions/
• Videos
https://youtu.be/Y3cC0Hpemmk
https://youtu.be/UvwQ6IwmcS4
https://youtu.be/noDVDV5sAUk

Microsoft Graph and Azure Functions - SharePoint User Group Frankfurt

  • 1.
    Microsoft Graph andAzure Functions Dragan Panjkov
  • 2.
  • 3.
    Agenda • Introducing MicrosoftGraph • Azure Functions • Using Microsoft Graph bindings in Azure Functions • Featured scenarios
  • 4.
  • 5.
    Microsoft Graph Office 365Platform STANDALONE WEB AND DEVICE APPS   Extensions Embedded canvases
  • 6.
    Users Groups OutlookOneNote more…SharePoint IntuneTeams Azure ADPlanner Excel https://graph.microsoft.com Your appOne endpoint One token All users Microsoft Graph API Access user, group and organizational data
  • 7.
    Calling the API •HTTP verbs dictate the request intent: GET | POST | PATCH | PUT | DELETE • Version: /v1.0 or /beta • Resource: /users, /groups, /sites, /drives, /devices, more… • Member from collection: /users/AAA • Property: /users/AAA/department • Traverse to related resources via navigations: /users/AAA/events • Query parameters: /users/AAA/events?$top=5 o Format results: $select | $orderby o Control results: $filter | $expand o Paging: $top | $skip | $skiptoken /{version} ?{query-parameters}/{resource}/{id}/{property}
  • 8.
  • 9.
  • 10.
    Calling the MicrosoftGraph Microsoft Graph
  • 11.
    Auth access_token Register your appat https://apps.dev.microsoft.com MSAL YOUR APP Microsoft Graph id_token access_token refresh_token Microsoft Identity
  • 12.
    App types andpermissions Users can consent for their data or admin can consent for all users Only admin can consent App permissions User permissions App permissions Permission type: applicationPermission type: delegated https://developer.microsoft.com/en-us/graph/docs/concepts/permissions_reference Get access on behalf of users Get access as a service Effective permissionEffective permission
  • 13.
  • 14.
  • 15.
    Microsoft Graph +Azure Functions Benefits of serverless Access data in Microsoft Graph Best in class security Built on Azure App Service
  • 16.
    Microsoft Graph bindings •Auth token input • Excel table input • Excel table output • OneDrive file input • OneDrive file output • Outlook message output • Microsoft Graph webhook triggers and bindings
  • 17.
  • 18.
    Prerequisites • Enable Functions2.0 preview • Install the extension • Microsoft.Azure.WebJobs.Extensions.AuthTokens • Microsoft.Azure.WebJobs.Extensions.MicrosoftGraph • Configure Authentication / Authorization
  • 19.
    Limitations • Currently inbeta • Only C# and JavaScript are supported inside the portal • Bugs • Cannot subscribe to webhook if not anonymous • Invalid Graph access token if using Client Credentials auth
  • 20.
  • 21.
    Resources • Graph Explorer www.aka.ms/ge •Microsoft Graph bindings on Azure Functions documentation site https://docs.microsoft.com/en-us/azure/azure-functions/functions- bindings-microsoft-graph • Announcement on beta release on Azure Functions blog https://blogs.msdn.microsoft.com/appserviceteam/2017/09/25/my-intern- project-microsoft-graph-bindings-for-azure-functions/ • Videos https://youtu.be/Y3cC0Hpemmk https://youtu.be/UvwQ6IwmcS4 https://youtu.be/noDVDV5sAUk