Skip to content

Commit 0626a07

Browse files
committed
add getCredentials function
1 parent 7b8a432 commit 0626a07

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

articles/active-directory/develop/test-automate-integration-testing.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ let tokenCache;
299299
const KVUri = keyVaultConfig.keyVaultUri;
300300
const secretName = keyVaultConfig.secretName;
301301

302+
async function getCredentials() {
303+
try {
304+
const credential = new DefaultAzureCredential();
305+
const secretClient = new SecretClient(KVUri, credential);
306+
const secret = await secretClient.getSecret(keyVaultConfig.secretName);
307+
const password = secret.value;
308+
return [secretName, password];
309+
} catch (error) {
310+
console.log(error);
311+
}
312+
}
313+
302314
test.beforeAll(async () => {
303315
const pca = new PublicClientApplication(msalConfig);
304316
const [username, password] = await getCredentials();

0 commit comments

Comments
 (0)