I have created a unique extension for Azure DevOps that includes a specialized Connected Service and Build task. When setting up the task through the pipeline visual designer, I am able to utilize the Connected Service to choose a service and then populate a picklist with data from my API.
My question is, how can I access the selected service when the task is running? In the index.ts file, I can obtain the Guid of the service using code similar to the snippet below. But, is there a way to use this Guid to retrieve the service or its details?
import tl = require('azure-pipelines-task-lib/task');
async function run() {
try {
const serviceString: string = tl.getInput('TestService', true);
if (serviceString == 'bad') {
tl.setResult(tl.TaskResult.Failed, 'Bad input was given');
return;
} ...
I have searched extensively and reviewed various articles but have not come across any examples that address this specific scenario.
https://learn.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
https://learn.microsoft.com/en-us/azure/devops/extend/develop/service-endpoints?view=azure-devops