Coder Social home page Coder Social logo

isabella232 / azure-functions-microsoftgraph-extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure/azure-functions-microsoftgraph-extension

0.0 0.0 0.0 241 KB

Microsoft Graph extension for Azure Functions

License: MIT License

C# 100.00%

azure-functions-microsoftgraph-extension's Introduction

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 [email protected] with any additional questions or comments.

azure-functions-microsoftgraph-extension's People

Contributors

baywet avatar connormcmahon avatar fabiocav avatar glennamanns avatar mattchenderson avatar microsoftopensource avatar mikestall avatar msftgits avatar panjkov avatar paulbatum avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.