i'm creating a Service Connection to Invoke REST API: POST task in the azure pipeline as per the below document, but im not sure sure what service connection should be added and what should be the server URL.
1 Answers
We can use Azure Resource Manager or Generic service connections in invoke REST API task. The Azure Resource Manager service connection is used to invoke an Azure management API and the Generic service connection is used for all other APIs. You can find this in the document.
Connection type:
The server URL is base URL for the call. Here are my examples:
- Generic
Server URL in the service connection: https://dev.azure.com/{Organization name}/{Project name}
Configuration of my task:
This REST API is used to create a new work item: https://docs.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/create?view=azure-devops-rest-6.1
The full URL is https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/${type}?api-version=6.1-preview.3
. It is composed of the server URL in the service connection and the URL suffix in the task.
- Azure Resource Manager
Configuration of my task:
This REST API is used to get all permissions the caller has for a resource group: https://docs.microsoft.com/en-us/rest/api/authorization/permissions/listforresourcegroup
The full URL is https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions?api-version=2015-07-01
. You just need to add subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions?api-version=2015-07-01
in the URL suffix.