Azure / azure-functions-microsoftgraph-extension

Microsoft Graph extension for Azure Functions
MIT License
46 stars 24 forks source link

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:

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:

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:

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.