Microsoft Graph extension for Azure Functions
Перейти к файлу
microsoft-github-policy-service[bot] 0edb2e497e
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2022-11-28 19:35:43 +00:00
samples/GraphExtensionSamples Update extension to work with WebJobs v3.0.0-beta5 (#42) 2018-03-30 16:20:04 -07:00
src rename property to IdentityConnectionString 2019-01-23 10:36:48 -08:00
test Update extensions to use latest version of webjobs 2018-10-12 11:22:36 -07:00
update Add manual update instructions 2018-04-02 10:58:14 -07:00
.gitattributes Initial add 2017-09-15 16:12:49 -07:00
.gitignore AppVeyor and YAML support 2017-09-15 17:06:53 -07:00
LICENSE Initial commit 2017-09-11 14:14:36 -07:00
Nuget.Config Migrate extensions to be compatible with webjobs DI work 2018-08-28 21:45:57 -07:00
README.md Adding pointer to Graph tutorial 2020-10-06 16:22:33 -07:00
SECURITY.md Microsoft mandatory file 2022-07-28 16:57:16 +00:00
WebJobs.Extensions.O365.sln Update extensions to use latest version of webjobs 2018-10-12 11:22:36 -07:00
appveyor.yml Fix AppVeyor build to include artifacts 2017-12-01 17:37:15 -08:00
blog.md Initial add 2017-09-15 16:12:49 -07:00
sign.snk Update the extension to have strong-name signing 2018-09-17 11:18:18 -07:00

README.md

Azure Functions bindings to O365

NOTE: This project is no longer maintained and is not recommended for new development. To integrate with the Microsoft Graph from Azure Functions, please instead see this tutorial.

Prototype for some WebJobs extension bindings.

This provides a sample Azure Function extensions for Office.

This provides a few bindings:

  • [Outlook] - sends emails from an O365 account
  • [OneDrive] - reads/writes a Onedrive file
  • [Excel] - reads/writes an Excel table or worksheet.
  • [Token] - this has been extended to allow binding to the MS Graph SDK's Graph Service Client
  • [GraphWebhookSubscription] - creates, deletes, or refreshes a Graph Webhook. See https://github.com/microsoftgraph/aspnet-webhooks-rest-sample for graph webhooks sample.
  • [GraphWebhookTrigger] - the trigger that activates a function when a Graph Webhook is called for its datatype

The bindings found in the Microsoft Graph extension use the same authentication process as those in the Token Extension. You can see how to use these bindings in the samples directory.

For Authentication

Authentication is built using Easy Auth's token store. (see https://cgillum.tech/2016/03/07/app-service-token-store/ ) The app has an AAD app registered that has been configured with access to the Graph API and given appropriate scopes. The bindings can access the client secret (via appsettings) and use that to perform token exchanges.

The bindings can authenticate in 4 different ways:

  • UserFromId - the token is grabbed on behalf of a provided user id
  • UserFromToken - the token is grabbed on behalf of a provided user id token
  • UserFromRequest - the token is grabbed on behalf of the user id token found in the HTTP header X-MS-TOKEN-AAD-ID-TOKEN
  • ClientCredentials - uses the app's credentials to access AAD

Source layout

The samples directory contains examples of how to use the bindings. The code for both the Token and Microsoft Graph extensions can be found in the src directory, and in-memory tests can be found in the tests directory.

Local Development

First create a Functions app using the Functions CLI found https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local. Be sure to use the Version 2.x runtime.

To install the Token extension, run the command func extensions install --package Microsoft.Azure.WebJobs.Extensions.AuthTokens -v <version>.

To install the Microsoft Graph extension, run the command func extensions install --package Microsoft.Azure.WebJobs.Extensions.MicrosoftGraph -v <version>.

The easiest way to utilize most of the features of these features is to configure an Azure Functions app in the Portal, enable Authentication/Authorization, add the extension, and go through the configuration to enable the proper Microsoft Graph permissions.

If you are making code changes to the extensions themselves and wish to test these locally, you can manually copy the .dll files that you build into your bin directory in your local function app's directory.

App Settings to Modify in local.settings.json:

  • WEBSITE_AUTH_CLIENT_ID - Copy from your App Settings in Kudu from your configured app
  • WEBSITE_AUTH_CLIENT_SECRET - Copy from your App Settings in Kudu from your configured app
  • WEBSITE_AUTH_OPENID_ISSUER - (Optional, Required for a ClientCredentials TokenIdentityMode) Copy from your App Settings in Kudu from your configured app (or set to https://sts.windows.net/<tenantID> for Azure Active Directory)
  • BYOB_TokenMap - A valid local directory that you have read/write access to

Current Version

Latest Version: 1.0.0-beta6 Portal Version: 1.0.0-beta5

If you want to get the latest features and bugfixes, you can manually update to the latest version by following the instructions in the update folder. NOTE: If you update to a different version than the version in the portal, you cannot use the Token and Microsoft Graph templates.

License

This project is under the benevolent umbrella of the .NET Foundation and is licensed under the MIT License

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.