in tasks/Node/src/modules/task-utils/resourceutil.ts [73:97]
async function getCredentials(forTesting?: boolean): Promise<any> {
let credentials: any;
if (forTesting) {
const options: msRestNodeAuth.LoginWithAuthFileOptions = {
filePath: 'authfile.json'
}
tl.debug(`ResourceUtil: Login using ${options.filePath}.`);
const response: msRestNodeAuth.AuthResponse = await msRestNodeAuth.loginWithAuthFileWithAuthResponse(options);
credentials = response.credentials;
}
else {
const connectedServiceName: string = String(tl.getInput('ConnectedServiceName', true));
const spId: string = String(tl.getEndpointAuthorizationParameter(connectedServiceName, 'ServicePrincipalId', false));
const spKey: string = String(tl.getEndpointAuthorizationParameter(connectedServiceName, 'ServicePrincipalKey', false));
const tenantId: string = String(tl.getEndpointAuthorizationParameter(connectedServiceName, 'TenantId', false));
tl.debug(`ResourceUtil: Login using ConnectedServiceName '${connectedServiceName}'.`);
credentials = await msRestNodeAuth.loginWithServicePrincipalSecret(spId, spKey, tenantId);
}
return credentials;
}