Invoke Azure Function task

Azure Pipelines | TFS 2018 | TFS 2017

Use this task in a build or release pipeline to invoke a HTTP triggered function in an Azure function app and parse the response.

Note

In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, service connections are called service endpoints, stages are called environments, and jobs are called phases.

Demands

Can be used in only an agentless job of a release pipeline.

YAML snippet

# Invoke Azure Function
# Invoke an Azure Function as a part of your pipeline.
- task: AzureFunction@1
  inputs:
    function: 
    key: 
    #method: 'POST' # Options: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, PATCH
    #headers: '{Content-Type:application/json, PlanUrl: $(system.CollectionUri), ProjectId: $(system.TeamProjectId), HubName: $(system.HostType), PlanId: $(system.PlanId), JobId: $(system.JobId), TimelineId: $(system.TimelineId), TaskInstanceId: $(system.TaskInstanceId), AuthToken: $(system.AccessToken)}' 
    #queryParameters: # Optional
    #body: # Required when method != GET && Method != HEAD
    #waitForCompletion: 'false' # Options: true, false
    #successCriteria: # Optional

Arguments

Parameter Comments
Azure function URL Required. The URL of the Azure function to be invoked.
Function key Required. The value of the available function or the host key for the function to be invoked. Should be secured by using a hidden variable.
Method Required. The HTTP method with which the function will be invoked.
Headers Optional. The header in JSON format to be attached to the request sent to the function.
Query parameters Optional. Query parameters to append to the function URL. Must not start with "?" or "&".
Body Optional. The request body for the Azure function call in JSON format.
Completion Event Required. How the task reports completion. Can be API response (the default) - completion is when function returns success and success criteria evaluates to true, or Callback - the Azure function makes a callback to update the timeline record.
Success criteria Optional. How to parse the response body for success.
Control options See Control options

Succeeds if the function returns success and the response body parsing is successful, or when the function updates the timeline record with success.

For more information about using this task, see Approvals and gates overview.

Also see this task on GitHub.