Azure Functions Connector Samples (Python): Azure DevOps polling
The Functions host pulls Azure DevOps events from the Connector Namespace polling endpoint. No public endpoint is required.
| Function / connector operation | Binding |
|---|---|
OnAzureDevOpsBuildCompleted / OnBuildCompleted |
List[devops.BuildResult] |
OnAzureDevOpsGitPullClosed / OnGitPullClosed |
List[devops.GitPullRequest] |
OnAzureDevOpsGitPullCreated / OnGitPullCreated |
List[devops.GitPullRequest] |
OnAzureDevOpsGitPush / OnGitPush |
List[devops.GitPush] |
OnAzureDevOpsTfvcCheckIn / OnTfvcCheckIn |
List[devops.TfvcChangeset] |
OnAzureDevOpsWorkItemAssigned / OnWorkItemAssignedV2 |
List[devops.TriggerWorkItemResponse] |
OnAzureDevOpsWorkItemClosed / OnWorkItemClosedV2 |
List[devops.TriggerWorkItemResponse] |
OnAzureDevOpsWorkItemCreated / OnWorkItemCreatedV2 |
List[devops.TriggerWorkItemResponse] |
OnAzureDevOpsWorkItemUpdated / OnWorkItemUpdatedV2 |
List[devops.TriggerWorkItemResponse] |
Handlers log event names and item counts, not content.
Prerequisites
- Azure Developer CLI 1.33+, Azure CLI 2.75+, and the connector-namespace extension.
- Python for the deployment hooks, plus PowerShell 7 on Windows.
- Azure permission to create resources and role assignments, such as Owner, or Contributor plus Role Based Access Control Administrator.
- An Azure DevOps account in the organization's home tenant, with project access and permission to manage service hooks. The organization's tenant policy must allow consent to the connector's Entra application.
- For local runs: Functions Core Tools and Azurite.
The app deploys on Python 3.14 and uses azurefunctions-extensions-connectors>=1.0.0. For older Python versions, see Python 3.12 and older supported versions.
Deploy to Azure
az login
azd auth login
azd env new azuredevops-polling
azd up
azd up then asks you to:
- Sign in to the Azure DevOps connection in the browser, if it isn't already connected.
- Choose Configure or Skip for each trigger. Configure at least one.
- For each configured trigger, pick the organization, project, and other inputs from live lists, or type them where no list exists. Optional filters can be skipped.
Skipped functions are still deployed, with their listeners disabled.
Choices are saved in the azd environment and reused by later azd up runs. To choose again, run azd env set POLLING_TRIGGER_INPUTS "", then azd up.
To skip prompts, copy trigger-inputs.example.json to trigger-inputs.json (ignored by git), keep only the triggers to configure, and replace every placeholder. Each entry is { "functionName", "operationName", "parameters": [{ "name", "value" }] } using connector wire names; account is the organization name, not a URL. The file takes precedence over saved choices.
azd up also deploys later code changes. To retry after a failure, rerun azd up.
| Optional setting | Purpose |
|---|---|
CONNECTOR_NAMESPACE_LOCATION |
Connector Namespace region (default brazilsouth). |
Local development
Start Azurite.
Install dependencies:
python -m venv .venv # Activate .venv for your shell. python -m pip install -r requirements.txtSign in with
az login, then runfunc start.
azd up creates local.settings.json if it doesn't exist. To regenerate it, run sh ./infra/scripts/postdeploy.sh --force-local-settings (or ./infra/scripts/postdeploy.ps1 -ForceLocalSettings).
Local and deployed listeners compete for the same events; stop the deployed app while testing locally.
Test
Trigger a configured event, such as queuing a build, pushing a commit, or creating a work item. Confirm the trigger configurations are enabled in Connector Namespaces and check the function logs for the event name and count.
Deprovision
azd down --purge
Service-hook subscriptions in Azure DevOps may remain; delete any you no longer need from the project's service hooks settings. Never commit credentials or local settings.