This repository contains Python samples that show how to use the new Connector Namespace integration with Azure Functions. Each sample lives in its own folder so you can clone, deploy, and explore independently with a single azd up.
Note
Connectors in Azure Functions are in public preview. The Connector Namespace is currently available in West Central US (westcentralus); your function app can be deployed in any region that supports the chosen hosting plan. See the overview for details.
-
Azure CLI (
az) ≥ 2.75.0 -
connector-namespaceAzure CLI extension — install with:# Bash curl -fsSL https://aka.ms/connector-namespace-cli-install | sh
or
# PowerShell irm https://aka.ms/connector-namespace-cli-install-ps | iex
-
jq(for bash post-deploy scripts on macOS/Linux)
Azure Functions integrates with the managed connectors platform that backs Logic Apps and Power Platform, giving your functions:
- Connector triggers — a function runs when an event occurs in an external service (new email in Office 365, file added to SharePoint or OneDrive, message posted to Microsoft Teams, and many more). The runtime exposes a
connector_triggerbinding that receives webhook callbacks from the Connector Namespace. - Connector SDK actions — function code calls connector operations through strongly-typed clients or through dynamic payload models for any connector.
The connector platform handles webhook registration, OAuth flows, token refresh, and retry — you focus on the business logic.
Seven self-contained Azure Functions apps, each deployable with azd up:
| App | Connector | Triggers demonstrated |
|---|---|---|
azureblobApp/ |
Azure Blob | OnAzureBlobUpdatedFile |
kustoApp/ |
Azure Data Explorer (Kusto) | OnKustoQueryResult |
office365App/ |
Office 365 Outlook | OnNewEmail, OnFlaggedEmail, OnNewMentionMeEmail, OnNewCalendarEvent, OnUpcomingEvent |
onedriveApp/ |
OneDrive for Business | OnOneDriveNewFile, OnOneDriveUpdatedFile |
sharepointApp/ |
SharePoint Online | OnSharepointNewFile, OnSharepointUpdatedFile |
teamsApp/ |
Microsoft Teams | OnNewChannelMessage, OnNewChannelMessageMentioningMe, OnGroupMembershipAdd, OnGroupMembershipRemoval |
genericApp/ |
any connector — uses the generic connector_trigger API |
Azure Blob, Office 365, SharePoint, Teams + a custom-type example |
| Package | Role |
|---|---|
azure-functions |
The Functions Python worker. Provides @app.connector_trigger decorator and the broader bindings surface. |
azurefunctions-extensions-connectors |
Rich SDK types for Office 365 connector triggers (ClientReceiveMessage, GraphClientReceiveMessage, GraphCalendarEventClientReceive). Used by office365App. |
A single function OnAzureBlobUpdatedFile that fires when blobs in a watched Azure Blob container are updated. The payload contains Name, Path, Size, LastModified fields.
OnKustoQueryResult runs whenever the configured Kusto query produces a non-empty result. Each row is accessible from the parsed JSON payload.
Five Outlook triggers using the azurefunctions-extensions-connectors package for rich type hints:
| Function | Type | Fires when… |
|---|---|---|
OnNewEmail |
List[ClientReceiveMessage] |
A new email lands in the watched mailbox / folder |
OnFlaggedEmail |
List[GraphClientReceiveMessage] |
An email is flagged (follow-up) |
OnNewMentionMeEmail |
List[GraphClientReceiveMessage] |
A new email @-mentions the connection identity |
OnNewCalendarEvent |
List[GraphCalendarEventClientReceive] |
A new calendar event is created |
OnUpcomingEvent |
List[GraphCalendarEventClientReceive] |
A calendar event is about to start |
OnOneDriveNewFile and OnOneDriveUpdatedFile. Both parse the payload to extract file metadata (Name, Path, Size, LastModified).
OnSharepointNewFile and OnSharepointUpdatedFile. Both parse the payload to extract file metadata.
Four Teams triggers:
| Function | Fires when… |
|---|---|
OnNewChannelMessage |
A new channel message is posted |
OnNewChannelMessageMentioningMe |
A channel message @-mentions the connection identity |
OnGroupMembershipAdd |
A user is added to a Teams group |
OnGroupMembershipRemoval |
A user is removed from a Teams group |
Demonstrates the generic API that works for any Azure Logic Apps connector — including connectors that do not have a first-class wrapper yet. The payload is received as a JSON string and parsed manually.
| Function | Connector |
|---|---|
OnGenericAzureBlobUpdated |
Azure Blob |
OnGenericOffice365NewEmail |
Office 365 |
OnGenericSharepointNewFile |
SharePoint Online |
OnGenericTeamsChannelMessage |
Teams |
OnGenericCustomConnectorEvent |
any custom connector |
import azure.functions as func
import azurefunctions.extensions.connectors.office365 as office365
from typing import List
app = func.FunctionApp()
@app.function_name(name="OnNewEmail")
@app.connector_trigger(arg_name="emails")
def on_new_email(emails: List[office365.ClientReceiveMessage]) -> None:
for email in emails:
logging.info(f"Subject: '{email.subject}'.")
logging.info(f"From: '{email.from_}'.")import azure.functions as func
import json
import logging
app = func.FunctionApp()
@app.function_name(name="OnAzureBlobUpdatedFile")
@app.connector_trigger(arg_name="payload")
def on_azure_blob_updated_file(payload: str) -> None:
data = json.loads(payload)
files = data.get("body", {}).get("value", [])
for file in files:
logging.info(f"Name: '{file.get('Name')}'.")
logging.info(f"Path: '{file.get('Path')}'.")cd <connectorAppPython>
pip install -r requirements.txt
func startUpdate local.settings.json with the runtime URL and access token for your connector before starting. The keys differ per connector (e.g. Office365Connection / OFFICE365_TOKEN, TeamsConnection / TEAMS_TOKEN).
cd <connectorAppPython>
azd auth login
azd upazd up provisions a resource group containing:
- Azure Storage account (Function App backing store).
- Flex Consumption Function App (Python 3.13) with system-assigned managed identity.
- Application Insights + Log Analytics workspace.
It then runs the prepackage hook (pip install -r requirements.txt) and deploys the Python code.
After provisioning, configure the connector runtime URL and token:
azd env set CONNECTOR_RUNTIME_URL '<your-connector-runtime-url>'
azd env set CONNECTOR_TOKEN '<your-token>'
azd provision # re-runs the Bicep to push the new app settingsfunctions-connectors-python/
├── README.md
├── azureblobAppPython/
├── kustoAppPython/
├── office365AppPython/
├── onedriveAppPython/
├── sharepointAppPython/
├── teamsAppPython/
└── genericAppPython/
Each app folder is self-contained:
<connectorAppPython>/
├── function_app.py # Python v2 programming model entry point
├── requirements.txt # Python dependencies
├── infra/
│ ├── main.bicep # subscription-scope: creates RG, delegates to resources.bicep
│ ├── resources.bicep # Storage + App Insights + Function App
│ └── main.parameters.json # ${AZURE_ENV_NAME}, ${AZURE_LOCATION}, ${CONNECTOR_RUNTIME_URL=}, ${CONNECTOR_TOKEN=}
├── azure.yaml # azd service definition + prepackage hook
├── host.json # Preview extension bundle + logging
├── local.settings.json # placeholders for runtime URL + token
└── README.md
| Repo | Purpose |
|---|---|
| Azure/connectors-python-SDK | azure-connectors — generated Python SDK for Azure Connectors. |
| Azure/azure-functions-python-extensions | azurefunctions-extensions-connectors — the binding extension consumed by these samples. |