Initial Intro – Azure function with SharePoint Online

Azure Functions are a very powerful auto upscaling server-less compute service provided by the Microsoft Azure cloud services.

“Azure Function” can be written in multiple languages such as JavaScript, C#, PowerShell, F#, Java and Microsoft has planned(/is planning) to integrate Go-Lang into their ecosystem as well.

Azure functions are provided in predominantly two major versions – 

1.x targeting the standard .NET Framework 

2.x targeting the .NET Core 2 version which further supports the macOS and Linux for cross platform development.

This specific example provides a simple overview into explaining the two different methodologies of Authenticating SharePoint-Online Client Object Model (CSOM) context with Azure Function : 

  1. Using Azure Active Directory
  2. SharePoint Application Client Id and Secret. (AppRegNew.aspx)

Using Azure Active Directory :

One of the easiest ways to getting started into creating a HelloWorld project is via the Azure Portal, with a few clicks for configuring the Azure Storage, Resource Group for web apps,  it scaffolds a API-Layer boilerplate code which supports GET and POST requests via HTTPS automatically provisioned and hosted under the .azurewebsites.net domain. 

What we need is not only the API layer but also an external library for communicating with SharePoint Online, the Microsot.SharePoint.Client.dll. 

The integration of external libraries is not trivial, as the “yourfunction.azurewebsites.net” is already hosted, and you need to upload the third party dlls into the wwwroot/bin folder to make it available for referencing and re-compiling it within your Function. To do this you need to open the KUDU portal for your web application from Azure portal, and upload any third party libraries under the wwwroot/bin folder. By referencing it via the “using” statement within your .csx file, the properties and methods are directly accessible within the Function along with intellisense.

The article from the famous Bob German (Technology Architect @Microsoft) has a 3 part series with detailed in-depth approach of how to get started – https://bob1german.com/2017/06/24/az-func-simplestart/

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑