An Azure service that provides an event-driven serverless compute platform.
Thank you for reaching out to Microsoft Q&A. I would implement this as a Microsoft Graph change-notification workflow for the SharePoint folder behind the Team's General channel. The notification endpoint should only validate and queue work; a separate Function should download the file, call the AI service, and upload the generated document.
Implementation Approach
When your provisioning Function creates the Team, retain the Team ID and obtain the General channel's file location:
GET https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{general-channel-id}/filesFolder
This returns the channel's SharePoint-backed driveItem including the drive and folder identifiers needed for subsequent file operations. Get filesFolder
Then create a Microsoft Graph subscription for file changes in that Drive/DriveItem. Point its notificationUrl at a public HTTPS HTTP-triggered Azure Function. Graph validates that endpoint by sending validationToken as a query parameter; the Function must return the URL-decoded token as text/plain with 200 OK within 10 seconds or the subscription is not created. Receive change notifications through webhooks
For each ordinary notification, I would use this flow:
- Check that the received
clientStatematches the random value supplied when the subscription was created. Receive change notifications through webhooks - Put the drive item ID and notification metadata on Azure Storage Queue or Service Bus, then return
202 Acceptedpromptly. Graph recommends queueing when processing cannot finish within three seconds; it can retry notifications, so the handler should be idempotent. Receive change notifications through webhooks - In a queue-triggered Function, obtain the current item metadata and download its content with
GET /drives/{drive-id}/items/{item-id}/content. Downloading a file with application permissions requires at leastFiles.Read.All. Download driveItem content - Check the file type and size against the AI endpoint's supported inputs, send the content to that endpoint, and generate a distinct result name such as
original-name-summary.docxso that the result upload does not retrigger processing of itself. - Upload the result to the same folder, or another designated folder, through Graph. A simple content upload supports files up to 250 MB and requires
Files.ReadWrite.Allfor application permissions; use an upload session for larger results. Upload or replace the contents of a driveItem
Persist the Graph subscription ID, monitored resource, expiration time, and clientState. Subscriptions expire and must be renewed. I would also configure lifecycle notifications and a timer-triggered renewal/reconciliation job, because notifications can be delayed, duplicated, or missed. subscription resource type Reduce missing subscriptions and change notifications
From my experience, keep the AI endpoint credential in Key Vault or Function app settings, never in source code or a SharePoint document. Grant only the Graph permissions needed for the selected read/write design, and restrict which file extensions and folders the worker accepts before content leaves Microsoft 365.
Please 'Upvote' (Thumbs-up) and 'Accept' as answer if the response was helpful. This will benefit other community members who face the same issue.
Best regards, Andrew S Taylor