Skip to content

Commit 5cd7947

Browse files
[Digital Twins] Use "@azure-tools/test-credential"; (Azure#20494)
1 parent c94fae7 commit 5cd7947

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

sdk/digitaltwins/digital-twins-core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@azure/dev-tool": "^1.0.0",
7575
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
7676
"@azure/identity": "^2.0.1",
77+
"@azure-tools/test-credential": "^1.0.0",
7778
"@azure-tools/test-recorder": "^1.0.0",
7879
"@microsoft/api-extractor": "^7.18.11",
7980
"@types/chai": "^4.1.6",

sdk/digitaltwins/digital-twins-core/test/utils/testAuthentication.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { ClientSecretCredential } from "@azure/identity";
54
import { DigitalTwinsClient } from "../../src";
65
import { env, record, RecorderEnvironmentSetup } from "@azure-tools/test-recorder";
76
import { uniqueString } from "./recorderUtils";
87
import TestClient from "./testClient";
8+
import { createTestCredential } from "@azure-tools/test-credential";
99

1010
export async function authenticate(that: Mocha.Context): Promise<any> {
1111
const keySuffix = uniqueString();
@@ -25,11 +25,7 @@ export async function authenticate(that: Mocha.Context): Promise<any> {
2525
queryParametersToSkip: [],
2626
};
2727
const recorder = record(that, recorderEnvSetup);
28-
const credential = new ClientSecretCredential(
29-
env.AZURE_TENANT_ID,
30-
env.AZURE_CLIENT_ID,
31-
env.AZURE_CLIENT_SECRET
32-
);
28+
const credential = createTestCredential();
3329
const AZURE_DIGITALTWINS_URL = env.AZURE_DIGITALTWINS_URL;
3430
const client = new DigitalTwinsClient(AZURE_DIGITALTWINS_URL, credential);
3531
const testClient = new TestClient(client);

0 commit comments

Comments
 (0)