AzureFunction@0 - Invoke Azure Function v0 task
Use this task in an agentless job of a release pipeline to invoke an HTTP triggered function in a function app and parse the response. The function app must be created and hosted in Azure Functions.
Syntax
# Invoke Azure Function v0
# Invoke Azure function as a part of your process.
- task: AzureFunction@0
inputs:
function: # string. Required. Azure function url.
key: # string. Required. Function key.
method: 'POST' # 'OPTIONS' | 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'TRACE' | 'PATCH'. Required. Method. Default: POST.
#headers: # string. Headers.
#queryParameters: # string. Query parameters.
#body: '{"JobId": "$(system.jobId)", "PlanId": "$(system.planId)", "TimelineId": "$(system.timelineId)", "ProjectId": "$(system.teamProjectId)", "VstsUrl": "$(system.CollectionUri)","AuthToken": "$(system.AccessToken)"}' # string. Optional. Use when method != GET && method != HEAD. Body. Default: {"JobId": "$(system.jobId)", "PlanId": "$(system.planId)", "TimelineId": "$(system.timelineId)", "ProjectId": "$(system.teamProjectId)", "VstsUrl": "$(system.CollectionUri)","AuthToken": "$(system.AccessToken)"}.
# Completion Options
waitForCompletion: 'false' # 'true' | 'false'. Required. Complete based on. Default: false.
#successCriteria: # string. Optional. Use when waitForCompletion = false. Success criteria.
Inputs
function
- Azure function url
string
. Required.
The URL of the Azure function to be invoked​. Example: https://azurefunctionapp.azurewebsites.net/api/HttpTriggerJS1
.
key
- Function key
string
. Required.
The function or the host key used to access and invoke the function. To keep the key secure, use a secret pipeline variable to store the function key. Example: $(myFunctionKey)
. myFunctionKey
is an environment-level secret variable with a value as the secret key.
method
- Method
string
. Required. Allowed values: OPTIONS
, GET
, HEAD
, POST
, PUT
, DELETE
, TRACE
, PATCH
. Default value: POST
.
The HTTP method with which the function will be invoked.
headers
- Headers
string
. Default value: {\n"Content-Type":"application/json"\n}
.
The header in JSON format to be attached to the request sent to the function.
queryParameters
- Query parameters
string
.
The string query to append to the function URL. Must not start with ?
or &
.
body
- Body
string
. Optional. Use when method != GET && method != HEAD
. Default value: {"JobId": "$(system.jobId)", "PlanId": "$(system.planId)", "TimelineId": "$(system.timelineId)", "ProjectId": "$(system.teamProjectId)", "VstsUrl": "$(system.CollectionUri)","AuthToken": "$(system.AccessToken)"}
.
The request body in JSON format.
waitForCompletion
- Complete based on
string
. Required. Allowed values: true
(Callback), false
(ApiResponse). Default value: false
.
How the task reports completion.
false
- API response - the function returns success and success criteria evaluates to true.true
- Callback - the function makes a callback to update the timeline record.
successCriteria
- Success criteria
string
. Optional. Use when waitForCompletion = false
.
The criteria for a successful task. By default, the task returns 200 OK
status when successful.
Example: For response {"status" : "successful"}
, the expression can be eq(root['status'], 'successful')
. Learn more about specifying conditions​.
Task control options
All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.
Output variables
None.
Remarks
AzureFunction@2 is a newer version of the Invoke Azure Function task.
Requirements
Requirement | Description |
---|---|
Pipeline types | Classic release |
Runs on | Server, ServerGate |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | All supported agent versions. |
Task category | Utility |
See also
- AzureFunction@2 is a newer version of the Invoke Azure Function task.