Until now, a Connector Namespace trigger pushed events to its destination: when an event arrived, the namespace called your app over HTTP. That works, but your app needs an endpoint the namespace can reach, and it has to absorb events whenever they show up. Polling delivery flips the direction. Your code connects outbound to the namespace and takes events when it's ready to process them.
What is a polling trigger?
A trigger configuration in Connector Namespace ties an event in an external service, such as a new row in a SQL table, a new email or a new file, to a destination. Each trigger configuration has a delivery mode that decides how events get from the namespace to your code.
With webhook delivery, the namespace pushes each event to a callback endpoint on your app. With polling delivery, the namespace holds the events for the trigger configuration, and your code connects outbound to retrieve them, processes them, and acknowledges each one when it's done. In Azure Functions you don't even write that loop: the Connector extension runs it and hands your function the events.
On the namespace side, a polling trigger configuration gets its own event queue, handles large messages, keeps run history, and protects against duplicate delivery.
One distinction is worth calling out early. The delivery mode controls how events travel from the namespace to your function app. It doesn't change how the managed connector detects changes in the source system. In the walkthrough below, the SQL connector still checks the table for new rows; polling only changes the last hop.
While polling is only supported out of the box in Azure Functions today, support for polling will be implemented for other partner services based on customer feedback. So, make your voice heard if it is something you want to see on other applications.
Why it matters
Choosing a delivery mode comes down to four things: latency, processing capacity, networking and authentication. Webhook delivery still wins on latency. Polling is the better fit for the other three.
| Capability | Polling | Webhook |
|---|---|---|
| Event delivery and latency | The Functions host retrieves events through outbound requests. Events wait until the host polls. | The namespace pushes events as soon as it picks them up from the source. Lower latency. |
| Processing capacity | The host takes more events as capacity frees up. Pending events stay queued in the namespace, subject to its retention limits. | Events arrive regardless of the app's capacity. Throttled or failed callbacks can lose events once retries run out. |
| Inbound networking | No inbound endpoint. Only outbound HTTPS to the namespace polling endpoint. | The namespace must be able to reach the app's callback endpoint. |
| Authentication | The function app's managed identity, with an access policy on the connection. | The Connector extension system key by default, or Microsoft Entra ID with App Service built-in authentication. |
Your function sets the pace
With webhook delivery, events land whenever the source produces them. If your app is at its scale-out limit, callbacks get throttled or fail, and an event that isn't delivered within the service's retry limits can be lost. With polling, the backlog waits in the namespace and the host pulls more work only when it has capacity. Combine your app's scale-out limit with the polling concurrency settings and you have a hard ceiling on how hard your function hits the database or API behind it.
No public endpoint
Polling doesn't need a public callback URL or a function app system key, because your app retrieves events instead of receiving callbacks. You can put the function app behind private endpoints or inbound access restrictions, and polling keeps working as long as the app can make outbound HTTPS calls to the namespace.
Managed identity instead of keys
The Functions host authenticates with Microsoft Entra ID. In Azure, that's the function app's system-assigned or user-assigned managed identity. On your machine, it's your developer identity. Either way, access is granted with an access policy on the managed connector connection, so there's no secret to store or rotate.
Scale that follows the backlog
In polling mode, the Connector trigger uses target-based scaling based on the estimated event backlog for the trigger configuration. The scaling target is independent of batch size and per-instance concurrency, so you can tune throughput and protection separately.
What you trade
Latency. An event waits in the namespace until the host polls for it. You can shorten the gap with the maxPollingInterval host setting, but if every millisecond counts, webhook is still the right mode. Polling delivery is also at least once: a failed invocation isn't acknowledged, and the event can come back after its lock expires, so make your processing idempotent.
Polling at a glance
Before the Azure Functions walkthrough, here's the shape of any polling setup. The first two steps happen in Connector Namespace and don't depend on the compute you choose. The last two happen wherever your code runs.
- Create a polling trigger configuration in your connector namespace. Pick the connector, the event, the connection and the inputs, and set the delivery mode to Polling. From then on, the namespace holds events for that configuration until your code takes them.
- Grant the consuming identity access with an access policy on the managed connector connection. In Azure that's a managed identity; on your machine it's your developer identity. No keys or secrets change hands.
- Point your code at the namespace with the polling endpoint and the trigger configuration name. There's no callback URL to register, so the consumer can sit behind private endpoints or inbound access restrictions.
- Poll, process and acknowledge. Your code retrieves events when it has capacity, processes them and acknowledges each one. An event that isn't acknowledged becomes available again after its lock expires, which is why delivery is at least once.
In Azure Functions, the Connector extension takes care of the fourth step: you declare the trigger, and the host runs the polling loop, invokes your function and acknowledges the events. The walkthrough maps onto the same pattern. You create the trigger configuration in Step 2, wire up the polling endpoint in Steps 3 and 6, and grant access in Steps 4 and 7.
webhook delivery pushes events into your app; polling delivery lets your app pull them.Walkthrough: process new SQL orders with a polling trigger
Here's the scenario. You have an Orders table in Azure SQL Database. SQL doesn't call anyone when a row is inserted, and the fulfilment system downstream can only take so many requests at once. You want a function that picks up each new order, without opening an inbound endpoint and without flooding fulfilment when a batch of orders lands at once.
The walkthrough uses C# with the .NET isolated worker and the Connector Namespace portal. Python and Node.js follow the same steps; the documentation has the code for both.
Before you start
You need:
- An Azure subscription and a connector namespace. If you don't have one, create a connector namespace first.
- An Azure SQL database with an Orders table. The SQL connector's new-item trigger needs an
IDENTITYcolumn on the table. - A .NET isolated worker Functions project, Azure Functions Core Tools and the Azure CLI.
Step 1: Add the Connector extension
Add version 1.0.0 or later of the Connector extension package to your project:
dotnet add package Microsoft.Azure.Functions.Worker.Extensions.Connector
Step 2: Create the polling trigger configuration
- Go to the Connector Namespace portal and select your namespace.
- In the namespace menu, select Triggers, and then select Create.
- Find the SQL Server connector and select the When an item is created (V2) event.
- Create a connection or select an existing one. Creating a connection takes a one-time authentication with your SQL server.
- Provide the inputs the event needs: the server, the database and the Orders table.
- For Destination type, choose Azure Functions. For message delivery method, choose Polling.
- Review the configuration, and then select Create.
Unlike webhook delivery, you don't need the function app deployed before you create the trigger configuration. The function finds the configuration by name.
Step 3: Copy the polling endpoint
Your function needs the namespace's polling endpoint. Copy it from the trigger configuration in the Connector Namespace portal:
| Configuration Required | Portal Value |
|---|---|
| ConnectorNamespace__PollingEndpoint | Base Url configuration |
| %TriggerConfigurationName% | Trigger Configuration name |
Step 4: Grant access to the connection
The identity that polls needs an access policy on the managed connector connection. Note that the policy goes on the connection, not on the namespace, and that signing in or turning on a managed identity doesn't grant this access by itself. For local development, the caller is your developer account. For a deployed app, it's the app's managed identity. Use the principal (object) ID, not the application (client) ID.
- In the Connector Namespace portal, select your namespace and open Connections.
- Select the SQL Server connection your trigger configuration uses.
- Open the Access Policies tab and add a policy for the caller identity.
- Check that the caller now appears in the connection's access policies.
Step 5: Write the function
The SQL connector doesn't have a strongly typed .NET payload yet, so the function binds to string and receives the raw JSON. Connectors that do have typed payloads, such as Office 365 Outlook, can bind to their payload model instead.
using System.Text.Json;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Extensions.Connector;
using Microsoft.Extensions.Logging;
namespace Contoso.Products;
public class SQLServerOnNewProduct
{
private readonly ILogger<SQLServerOnNewProduct> _logger;
public SQLServerOnNewProduct(ILogger<SQLServerOnNewProduct> logger)
{
_logger = logger;
}
[Function(nameof(SQLServerOnNewProduct))]
public void Run(
[ConnectorTrigger(
DeliveryMode = ConnectorTriggerDeliveryMode.Poll,
Connection = "ConnectorNamespace",
TriggerConfigName = "%ONSQLNewProductTriggerConfigName%")]
string payload)
{
using var document = JsonDocument.Parse(payload);
var productName = document.RootElement
.GetProperty("body")
.GetProperty("Name")
.GetString() ?? throw new JsonException("The product name must not be null.");
_logger.LogInformation("Received product: {ProductName}.", productName);
}
}
Three properties do the work. DeliveryMode = ConnectorTriggerDeliveryMode.Poll switches the trigger from the default webhook mode to polling. Connection = "ConnectorNamespace" is a settings prefix: the extension reads the polling endpoint from ConnectorNamespace__pollingEndpoint and the identity settings from the same prefix. TriggerConfigName points at the trigger configuration, here through the NewOrderTriggerConfigName app setting so you can change it per environment.
Step 6: Run it locally
Add the settings to the Values section of local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"ConnectorNamespace__pollingEndpoint": "<my-trigger-base-url>",
"ONSQLNewProductTriggerConfigName": "<my-trigger-configuration-name>"
}
}
Leave out ConnectorNamespace__credential locally, and the extension uses your developer credentials. Sign in, start the host, and insert a row:
az login
func start
-- Insert 3 sample products into AdventureWorksLT (SalesLT.Product)
-- ProductID is an IDENTITY column; rowguid and ModifiedDate have defaults.
INSERT INTO SalesLT.Product
(Name, ProductNumber, Color, StandardCost, ListPrice, Size, Weight,
ProductCategoryID, SellStartDate)
OUTPUT
inserted.ProductID, inserted.Name, inserted.ProductNumber,
inserted.ListPrice, inserted.ModifiedDate
VALUES
(N'Polling Trail Bike 42', N'CN-POLL-001', N'Red', 812.50, 1299.99, N'42', 11800.00,
(SELECT ProductCategoryID FROM SalesLT.ProductCategory WHERE Name = N'Mountain Bikes'),
GETDATE()),
(N'Polling Aero Helmet', N'CN-POLL-002', N'Black', 22.75, 49.99, NULL, NULL,
(SELECT ProductCategoryID FROM SalesLT.ProductCategory WHERE Name = N'Helmets'),
GETDATE()),
(N'Polling Water Bottle 750ml', N'CN-POLL-003', N'Blue', 2.10, 6.99, NULL, NULL,
(SELECT ProductCategoryID FROM SalesLT.ProductCategory WHERE Name = N'Bottles and Cages'),
GETDATE());
Within the next polling cycle, the function logs the new order.
Step 7: Deploy with a managed identity
- In the Azure portal, open your function app, go to Identity, and turn on the system-assigned managed identity. You can assign a user-assigned identity instead.
- Grant that identity an access policy on the SQL Server connection, as in step 4, using its principal (object) ID.
- Add the app settings below under Environment variables.
- Publish the app with
func azure functionapp publish <FUNCTION_APP>.
| App setting | Value |
|---|---|
ConnectorNamespace__pollingEndpoint | The polling endpoint from step 3 |
NewOrderTriggerConfigName | new-orders |
ConnectorNamespace__credential | managedidentity |
ConnectorNamespace__clientId | The client ID of the user-assigned identity. Set it only for a user-assigned identity, or set ConnectorNamespace__managedIdentityResourceId instead. Omit both for a system-assigned identity. |
Because nothing calls into the app, you can now restrict inbound access with private endpoints or access restrictions. Polling only needs outbound HTTPS to the namespace.
Step 8: Tune throughput and protect what's downstream
The defaults work, but polling gives you levers that webhook doesn't. To take orders in batches, turn on batching and bind to an array of events:
[Function("OnNewOrders")]
public void OnNewOrders(
[ConnectorTrigger(
DeliveryMode = ConnectorTriggerDeliveryMode.Poll,
Connection = "ConnectorNamespace",
TriggerConfigName = "%NewOrderTriggerConfigName%",
IsBatched = true,
MaxBatchSize = 8,
TargetPendingEventThreshold = 16)]
ConnectorEvent<string>[] events)
{
foreach (var orderEvent in events)
{
logger.LogInformation("Processing event {MessageId}.", orderEvent.MessageId);
// Parse orderEvent.Data and hand the order to fulfilment.
}
}
| Property | Default | What it controls |
|---|---|---|
IsBatched | false | Whether each invocation receives a batch of events. Batches are processed one at a time per listener. |
MaxBatchSize | 1 | Maximum events per invocation, from 1 through 32. Must be 1 when IsBatched is false. |
MaxConcurrentCalls | 16 | Maximum concurrent single-event invocations per listener on one instance. Applies only when IsBatched is false. |
TargetPendingEventThreshold | 16 | Desired pending events per instance for target-based scaling. Doesn't change batch size or concurrency. |
Each property falls back to an app-wide default in host.json when you omit it or set it to 0. The same section holds the polling interval. This example caps the wait between polls at one second when no events are available:
{
"version": "2.0",
"extensions": {
"connector": {
"maxPollingInterval": "00:00:01"
}
}
}
Two more things before you go to production. Delivery is at least once, so make the processing idempotent; for an order, that usually means checking whether you've already sent it to fulfilment. If you deduplicate on
ConnectorEvent<T>.MessageId, scope it to the namespace and trigger configuration, because message IDs aren't guaranteed unique across triggers.
Feedback
Polling is the first delivery mode in Connector Namespace where your code sets the pace, and we want to know how it holds up in your workloads. I'm especially interested in three things: which source systems you're polling, how you're setting batch size and concurrency, and what's missing before you'd run it in production.
Tell us in GitHub Issues. For bugs in the Connector extension, open an issue here.
To go further: