Skip to content

Latest commit

 

History

History
204 lines (159 loc) · 7.49 KB

azure-function-v0.md

File metadata and controls

204 lines (159 loc) · 7.49 KB
title description ms.date monikerRange
AzureFunction@0 - Invoke Azure Function v0 task
Invoke Azure function as a part of your process.
05/14/2024
<=azure-pipelines

AzureFunction@0 - Invoke Azure Function v0 task

:::moniker range="<=azure-pipelines"

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.

:::moniker-end

Syntax

:::moniker range=">=azure-pipelines-2019"

# 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.

:::moniker-end

Inputs

:::moniker range="<=azure-pipelines"

function - Azure function url
string. Required.

The URL of the Azure function to be invoked​. Example: https://azurefunctionapp.azurewebsites.net/api/HttpTriggerJS1.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

queryParameters - Query parameters
string.

The string query to append to the function URL. Must not start with ? or &.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.


:::moniker-end

:::moniker range="<=azure-pipelines"

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.

:::moniker-end

:::moniker range="<=azure-pipelines"

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​.


:::moniker-end

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

:::moniker range="<=azure-pipelines"

None.

:::moniker-end

Remarks

AzureFunction@2 is a newer version of the Invoke Azure Function task.

Requirements

:::moniker range="<=azure-pipelines"

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

:::moniker-end

See also