Integrating Sharepoint With Azure Services: Logic Apps, Functions, And More

An Overview of Connecting SharePoint and Azure

SharePoint and Azure offer complementary capabilities that can be integrated to enhance collaboration, productivity, and data insights. By connecting SharePoint’s collaboration and content management features with Azure’s scalable cloud services, organizations can optimize workflows, apply intelligence, and enable more powerful cross-platform search and productivity.

Key Azure services to integrate with SharePoint include:

  • Logic Apps – Automate workflows and business processes
  • Functions – Extend capabilities with serverless code
  • SQL Database – Store relational data
  • Search – Unify insights across data sources
  • Storage – Securely manage files and other content

Connecting SharePoint and Azure

At a high-level, SharePoint and Azure can be connected via:

  • Using SharePoint triggers in Azure services like Logic Apps and Functions to respond to SharePoint events
  • Calling SharePoint’s web APIs from Azure code to interact with SharePoint objects like lists and libraries
  • Indexing SharePoint content in Azure Search’s search engine to enable unified search
  • Syncing or backing up SharePoint document libraries to Azure Storage for more scalable storage

Using Logic Apps to Automate SharePoint Workflows

Logic Apps provides pre-built connectors for SharePoint to simplify integration. This enables creating automated workflows and processes triggered by SharePoint events, such as when a new item is added to a SharePoint list.

Example workflows include:

  • Approving SharePoint list items
  • Routing documents based on metadata
  • Sending email alerts on list updates

Leveraging Azure Functions to Extend SharePoint

Azure Functions can integrate with SharePoint via triggers and bindings, allowing serverless code to execute on demand to extend SharePoint capabilities.

Scenarios include:

  • Validating and modifying list items
  • Calling legacy systems
  • Advanced document processing

Storing SharePoint Data in Azure SQL Databases

For more scalability, SharePoint data can be stored in and synced with Azure SQL Databases. This is optimal for sites with heavy workloads and data needs.

Benefits include:

  • Cost efficient SQL DBs
  • Scale on demand
  • Built-in intelligence
  • Enhanced backup and recovery

Enabling Search Across SharePoint and Azure with Azure Search

Azure Search can index SharePoint content, combine it with other data sources in Azure, and enable powerful search across all that data.

This delivers:

  • Unified search experience
  • Advanced analytics around content
  • External data enrichment

Key Integration Scenarios and Example Code

Syncing SharePoint Lists with Azure Tables

SharePoint lists can sync with Azure tables bi-directionally using Logic Apps for more robust data and workflows.

Example trigger code:

"When_a_new_item_is_added_in_SharePoint_List" {

  "inputs": {
    "body": {
      "properties": {
        "siteUrl": "https://contoso.sharepoint.com/sites/sample",   
        "listId": "b5b3a5db-ba9a-4a1c-bea0-e25a04f8512e", 
      },
      "recurrence": {
        "frequency": "Minute",
        "interval": 3,  
      }
    },
    "host": {
      "connection": {
        "name": "@parameters('$connections')['sharepointonline']['connectionId']"  
      } 
    }
  },

  "runAfter": {}  

}

Calling SharePoint REST APIs from Azure Functions

SharePoint REST APIs allow accessing SharePoint objects like lists and libraries from Azure Functions.

Example HTTP trigger JavaScript code:

 
const request = require('request');

module.exports = async function (context, req) {

    const siteUrl = "https://contoso.sharepoint.com/sites/myteam"; 
    const listName = "Documents";
    const accessToken = "ABC123";

    try {

        var response = await callSharePoint(siteUrl, accessToken, listName);
        context.res = {
            body: response
        };

    } catch (error) {
        context.res = {
            status: 500,
            body: error
        };
    }

}


async function callSharePoint(siteUrl, accessToken, listName) {

    var url = `${siteUrl}/_api/web/lists/getbytitle('${listName}')`;
    var options = {
        headers: {
            "authorization": `Bearer ${accessToken}`
        }
    }

    return new Promise((resolve, reject) => {
        request.get(url, options, (err, resp, body) => {
            if (err) {
                reject(err);
            }
            else {
                resolve(JSON.parse(body));
            }
        })
    })
}

Searching SharePoint and Blob Storage with Azure Search

An Azure Search index can unify documents from SharePoint, Blob Storage, and other sources.

Example index configuration:

{
    "name": "contentindex",  
    "fields": [
        {"name": "id", "type": "Edm.String", "key": true"},
        {"name": "content", "type": "Edm.String"},
        {"name": "source", "type": "Edm.String"}
    ],
    "dataSources": [
        {
            "name": "SharePointDocs",
            "type": "sharepoint",  
            "credentials": { "connectionString": "" }, 
            "container": { "name": "Documents", "query": null }   
        },
        {
            "name": "BlobDocs",
            "type": "azureblob",
            "credentials": { "connectionString": "" },
            "container": { "name": "documents", "query": null }  
        }
    ]
}

Considerations for Security, Compliance and Governance

Managing Access Controls Between Azure and SharePoint

Access controls need to be properly configured in both SharePoint and connected Azure services to ensure users and applications only have permitted access.

Methods include:

  • Integrating Azure AD identities
  • App-only tokens in Azure
  • SharePoint roles and permissions

Auditing Changes and Access with Azure Monitor

Azure Monitor provides logging for access and changes to resources like storage, databases and functions. These logs can meet compliance needs.

Benefits:

  • Log archival and analytics
  • Alert rule configuration
  • Dashboards over activity

Backing up SharePoint to Azure Blob Storage

SharePoint farms can be backed up to geo-replicated blob containers in Azure for enhanced data protection.

Capabilities:

  • Point-in-time restore
  • Immutable blob snapshots
  • Defined retention policies
  • Encrypted storage

Getting Started with SharePoint and Azure Integrations

Assessing Integration Requirements

When planning SharePoint plus Azure integrations, key considerations include:

  • End user and admin needs
  • Security, compliance and governance
  • Existing architecture and pain points
  • Data flow and synchronization
  • Development costs

Step-by-Step Tutorials

Microsoft provides detailed tutorials on integrating SharePoint with Azure services like Logic Apps, Functions and Search. These walk through end-to-end deployment and testing.

Best Practices for Production Integrations

For SharePoint plus Azure integrations in production, best practices around security, monitoring, continuity and DevOps should be followed including:

  • Regularly regression test integrations
  • Monitor application logs
  • Enable high availability and geo-distribution if required
  • Have contingency plans for endpoint outages
  • Follow identity and access guidelines

Leave a Reply

Your email address will not be published. Required fields are marked *