I’m developing a web extension and I’m trying to consume credentials from a service connection using the Azure DevOps SDK. My goal is to use these credentials to connect to an AWS account. Here is the code I’m working with:
I am able to retrieve the service connection, but I am unsure how to extract the necessary credentials from serviceConnection to use them for connecting to an AWS account. Is it possible to achieve this using the Azure DevOps SDK? If so, could you provide an example or guidance on how to proceed?
import { getService } from "azure-devops-extension-sdk";
export async function consumeServiceConnection() {
console.log("Consuming service...");
try {
const serviceConnection = await getService<any>('8e074b6-599-4eb8-b7c7-e98f78202e0');
console.log("Credentials", serviceConnection);
// Additional logic to use the credentials for AWS connection
// ...
} catch (error) {
console.error('Error getting the service:', error);
}
}