Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to enable live testing in sovereign clouds for multiple services #16213

Closed
wants to merge 196 commits into from
Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
32ae375
update eventhubs
LuHang2021 Jul 6, 2021
e091946
update capacity
LuHang2021 Jul 8, 2021
d59cb6c
update eventhub
LuHang2021 Jul 9, 2021
674000c
update eventhub
LuHang2021 Jul 13, 2021
f65e101
update tests.yml
v-jiaodi Jul 15, 2021
0f22f57
update test-resources.json
v-jiaodi Jul 16, 2021
76398a6
update tests.yml
v-jiaodi Jul 19, 2021
015df6b
update search
zzhxiaofeng Jul 20, 2021
a8ed73f
update search
zzhxiaofeng Jul 21, 2021
316cd76
update search
zzhxiaofeng Jul 22, 2021
c248a76
update search
zzhxiaofeng Jul 22, 2021
94f3e83
update search
zzhxiaofeng Jul 22, 2021
ca16540
update search
zzhxiaofeng Jul 22, 2021
0b1c72f
update search
zzhxiaofeng Jul 22, 2021
613ffbd
update appconfig
zzhxiaofeng Jul 22, 2021
eaedc9a
update appconfig test
zzhxiaofeng Jul 27, 2021
7c34c59
update appConfigCredential.ts
zzhxiaofeng Jul 30, 2021
290cd77
update appconfig
zzhxiaofeng Aug 4, 2021
cdfd62a
update yml file
zzhxiaofeng Aug 5, 2021
3211fe4
update yml files
zzhxiaofeng Aug 10, 2021
abd02cf
update eventhub
zzhxiaofeng Aug 11, 2021
4cbc224
update eventhub
zzhxiaofeng Aug 11, 2021
7a5d25f
update eventhub
zzhxiaofeng Aug 23, 2021
4fd15dc
update eventhub
zzhxiaofeng Aug 24, 2021
78aea01
update eventhub
zzhxiaofeng Aug 26, 2021
7ac5c4d
update textanalytics
zzhxiaofeng Aug 27, 2021
17fdcd4
update form recognizer
zzhxiaofeng Aug 31, 2021
5d50785
update form recognizer
zzhxiaofeng Aug 31, 2021
bf2774a
update text analytics
zzhxiaofeng Sep 2, 2021
8caa9aa
update to latest
zzhxiaofeng Sep 2, 2021
8a28dbe
update search document
zzhxiaofeng Sep 2, 2021
598c7bd
update search
zzhxiaofeng Sep 2, 2021
4597d46
udpate formrecognizer
zzhxiaofeng Sep 3, 2021
1a532db
update textanalytics
zzhxiaofeng Sep 7, 2021
f8c1d51
update formrecognizer
zzhxiaofeng Sep 9, 2021
5f84ac2
update form recognizer
zzhxiaofeng Sep 9, 2021
b47ce27
update form recognizer
zzhxiaofeng Sep 9, 2021
a40bf9a
update text analytics
zzhxiaofeng Sep 10, 2021
662c68c
update form recognizer
zzhxiaofeng Sep 10, 2021
c55f195
update app configuration
zzhxiaofeng Sep 11, 2021
48e0e71
update service bus
zzhxiaofeng Sep 11, 2021
822ed95
update appconfiguration
zzhxiaofeng Sep 15, 2021
caf330e
update app configuration
zzhxiaofeng Sep 15, 2021
79fc1e7
update app configuration
zzhxiaofeng Sep 15, 2021
984b5c7
update textanalytics
zzhxiaofeng Sep 18, 2021
4c8e56d
Merge branch 'main' into sov-test
zzhxiaofeng Sep 18, 2021
56db029
update event hub
zzhxiaofeng Sep 18, 2021
99c6372
update service bus
zzhxiaofeng Sep 23, 2021
597ab49
update service bus
zzhxiaofeng Sep 23, 2021
394f257
update key vault keys
zzhxiaofeng Sep 24, 2021
fd8d96c
update service bus
zzhxiaofeng Sep 24, 2021
1ceef9e
update key vault keys
zzhxiaofeng Sep 24, 2021
207b754
update key vault keys
zzhxiaofeng Sep 29, 2021
01a6fba
update key vault keys
zzhxiaofeng Sep 29, 2021
95edae7
update key vault keys
zzhxiaofeng Sep 30, 2021
d35cc65
update key vault secrets
zzhxiaofeng Sep 30, 2021
0aea99b
update key vault secret
zzhxiaofeng Sep 30, 2021
efd3738
update key vault
zzhxiaofeng Oct 8, 2021
6a9a9c1
update key vault secrets
zzhxiaofeng Oct 8, 2021
db12a5b
update to latest
zzhxiaofeng Oct 8, 2021
6f18e8b
update key vault secrets
zzhxiaofeng Oct 8, 2021
08d7c71
update key vault secrets
zzhxiaofeng Oct 9, 2021
0ca7a80
update to latest
zzhxiaofeng Oct 9, 2021
12f3831
update key vault keys
zzhxiaofeng Oct 11, 2021
6530ae2
update key vault keys
zzhxiaofeng Oct 11, 2021
01be10e
update key vault secrets
zzhxiaofeng Oct 12, 2021
4b27520
update key vault keys
zzhxiaofeng Oct 14, 2021
787983a
update key vault secrets
zzhxiaofeng Oct 14, 2021
ad3022b
update key vault certificates
zzhxiaofeng Oct 15, 2021
4e4de66
update key vault secrets
zzhxiaofeng Oct 15, 2021
0385b3f
udpate key vault secrets
zzhxiaofeng Oct 15, 2021
1434632
update key vault secrets
zzhxiaofeng Oct 18, 2021
489ea00
update key vault secrets
zzhxiaofeng Oct 18, 2021
14fcc5f
update key vault
zzhxiaofeng Oct 18, 2021
b040909
update key vault secrets
zzhxiaofeng Oct 19, 2021
ca57ed5
update key vault keys
zzhxiaofeng Oct 19, 2021
b13fc0f
update to latest
zzhxiaofeng Oct 20, 2021
3b199b1
update key vault
zzhxiaofeng Oct 20, 2021
af5e100
update service bus
zzhxiaofeng Oct 26, 2021
c602d9a
update to latest
zzhxiaofeng Oct 26, 2021
cc0b5d4
update event hub
zzhxiaofeng Oct 27, 2021
146dcce
update to latest
zzhxiaofeng Oct 28, 2021
1306892
update event hub
zzhxiaofeng Oct 28, 2021
3fb6c5a
update key vault keys
zzhxiaofeng Oct 29, 2021
aa4b5e8
update event hub
zzhxiaofeng Oct 29, 2021
a734777
update event hub
zzhxiaofeng Oct 29, 2021
6c90c84
update to latest
zzhxiaofeng Nov 1, 2021
3ec70f1
update event hub
zzhxiaofeng Nov 2, 2021
7390811
update event hub
zzhxiaofeng Nov 4, 2021
c040380
update to latest
zzhxiaofeng Nov 4, 2021
8c8d04e
update event hub
zzhxiaofeng Nov 4, 2021
fdd6823
update event hub
zzhxiaofeng Nov 5, 2021
858b012
update to latest
zzhxiaofeng Nov 9, 2021
fef6744
update to latest
zzhxiaofeng Nov 10, 2021
0b84bed
update key vault admin
zzhxiaofeng Nov 10, 2021
7f2de44
update to latest
zzhxiaofeng Nov 16, 2021
86a7900
update key vault certificates
zzhxiaofeng Nov 16, 2021
052649b
update key vault admin
zzhxiaofeng Nov 16, 2021
0858c03
update event hub
zzhxiaofeng Nov 17, 2021
be34737
update to latest
zzhxiaofeng Nov 18, 2021
8c9d6e8
update event hub
zzhxiaofeng Nov 18, 2021
ccd9cb9
update event hub
zzhxiaofeng Nov 19, 2021
f0689f2
udpate to latest
zzhxiaofeng Nov 30, 2021
71b9b84
update text analytics
zzhxiaofeng Dec 1, 2021
2eb81c0
update key vault certificate
zzhxiaofeng Dec 3, 2021
c245d3d
update to latest
zzhxiaofeng Dec 6, 2021
bf71d5e
update to latest
zzhxiaofeng Dec 16, 2021
1fa8d2f
update key vault certificate
zzhxiaofeng Dec 16, 2021
d8f7a9e
update to latest
zzhxiaofeng Dec 20, 2021
1ea7461
update key vault certificate
zzhxiaofeng Dec 22, 2021
e8f212b
update to latest
zzhxiaofeng Dec 23, 2021
c13892a
update service bus
zzhxiaofeng Dec 24, 2021
f9c6378
update to latest
zzhxiaofeng Dec 28, 2021
1cc80fc
update form recognizer
zzhxiaofeng Dec 29, 2021
b5823e3
update to latest
zzhxiaofeng Jan 29, 2022
4f6bc7d
Update tests.yml
zedy-wj Jan 30, 2022
711241f
Update serviceBusClient.spec.ts
zedy-wj Jan 30, 2022
929b458
Update textAnalyticsClient.spec.ts
zedy-wj Jan 30, 2022
4faa97e
remove changes
Jan 30, 2022
050e7ca
Merge branch 'main' of https://github.com/zzhxiaofeng/azure-sdk-for-j…
Feb 7, 2022
db15538
fix unstable bug
Feb 7, 2022
82e61e8
upgrade poller
Feb 8, 2022
b70cb84
Remove invalid changes, fix unstable bug
Feb 8, 2022
30c7b22
remove invalid changes, fix unstable bug
Feb 8, 2022
880eab8
resolve conflict
Mar 1, 2022
7555289
set a long time for usgov and china clouds
Mar 1, 2022
1fbbbe7
add retry number in unstable test
Mar 1, 2022
7326bf1
check the error position
Mar 2, 2022
b20bb3e
check the error position
Mar 2, 2022
faf6e30
Merge remote-tracking branch 'upstream/main' into sov-test
Mar 3, 2022
a4c2bf4
Merge remote-tracking branch 'upstream/main' into sov-test
Mar 11, 2022
30ba099
locate the time out steps
Mar 24, 2022
7caa3f1
increase the timeout to 150 min
Apr 22, 2022
9238c5b
Merge branch 'main' of https://github.com/zzhxiaofeng/azure-sdk-for-j…
zedy-wj Apr 27, 2022
15b68dc
test fix china time out bug
zedy-wj May 16, 2022
2415d11
fix conflict
zedy-wj May 16, 2022
cb6b8b2
fix conflict
zedy-wj May 30, 2022
2abe9ae
fix some variable
zedy-wj May 30, 2022
75aa2d3
add minutes in eventhub tests
zedy-wj May 30, 2022
c2ed62e
update Timeout times
zedy-wj May 30, 2022
8c222af
fix time issue
zedy-wj May 31, 2022
db48a4c
update variables
zedy-wj May 31, 2022
5e7ae35
remove some invalid variable
zedy-wj May 31, 2022
4f600b3
Merge remote-tracking branch 'upstream/main' into sov-test
Jun 28, 2022
cccd3d7
fix conflict
Jul 25, 2022
4dcdd6d
Merge remote-tracking branch 'upstream/main' into sov-test
Aug 29, 2022
99d5d10
Merge remote-tracking branch 'upstream/main' into sov-test
Sep 22, 2022
3502b4e
Merge remote-tracking branch 'upstream/main' into sov-test
Oct 24, 2022
75f0c60
Merge remote-tracking branch 'upstream/main' into sov-test
Nov 29, 2022
0dbe426
Merge remote-tracking branch 'upstream/main' into sov-test
zedy-wj Dec 28, 2022
98ba94b
Merge remote-tracking branch 'upstream/main' into sov-test
Feb 2, 2023
7e6357b
Merge remote-tracking branch 'upstream/main' into sov-test
Mar 1, 2023
fbd583a
Update eventHubConsumerClient.spec.ts
zedy-wj Mar 13, 2023
88b78be
Update tests.yml
zedy-wj Mar 14, 2023
3155f4d
Update eventHubConsumerClient.spec.ts
zedy-wj Mar 14, 2023
f0a961c
Update eventHubConsumerClient.spec.ts
zedy-wj Mar 14, 2023
2434955
Update package.json
zedy-wj Mar 14, 2023
0128289
Update package.json
zedy-wj Mar 14, 2023
ab8ee84
fix conflict
Apr 23, 2023
14a93ef
Merge remote-tracking branch 'upstream/main' into sov-test
Apr 26, 2023
6f2689b
add cloud config
Apr 26, 2023
42dc96d
Merge remote-tracking branch 'upstream/main' into sov-test
May 29, 2023
f43b09c
Merge branch 'sov-test' of https://github.com/zzhxiaofeng/azure-sdk-f…
May 29, 2023
e306a02
Merge remote-tracking branch 'upstream/main' into sov-test
Jun 28, 2023
a7dadcc
Merge branch 'sov-test' of https://github.com/zzhxiaofeng/azure-sdk-f…
Jun 28, 2023
1ca05b0
Merge remote-tracking branch 'upstream/main' into sov-test
Jul 26, 2023
3459275
Merge remote-tracking branch 'upstream/main' into sov-test
Aug 30, 2023
c971c7e
fix some error
Aug 31, 2023
0153984
Merge remote-tracking branch 'upstream/main' into sov-test
Sep 25, 2023
fb79927
remove invalid changes
Sep 25, 2023
4386547
remove invalid changes
Sep 25, 2023
a4fe3c0
Merge remote-tracking branch 'upstream/main' into sov-test
Oct 31, 2023
e7a5f2a
Merge remote-tracking branch 'upstream/main' into sov-test
Nov 29, 2023
70d7a61
Merge remote-tracking branch 'upstream/main' into sov-test
Dec 27, 2023
5426792
Merge remote-tracking branch 'upstream/main' into sov-test
Feb 1, 2024
d3fa479
Merge remote-tracking branch 'upstream/main' into sov-test
Feb 29, 2024
02d47aa
Merge remote-tracking branch 'upstream/main' into sov-test
Mar 14, 2024
6a85ad0
Merge remote-tracking branch 'upstream/main' into sov-test
Mar 27, 2024
185e6cb
Merge remote-tracking branch 'upstream/main' into sov-test
Apr 23, 2024
8067646
Merge remote-tracking branch 'upstream/main' into sov-test
Apr 29, 2024
2756c33
Merge remote-tracking branch 'upstream/main' into sov-test
May 29, 2024
6b9269d
Merge remote-tracking branch 'upstream/main' into sov-test
Jun 26, 2024
3240cbf
Merge remote-tracking branch 'upstream/main' into sov-test
Jun 28, 2024
faffb9e
fix conflict
Jul 30, 2024
12107b8
Merge branch 'sov-test' of https://github.com/zzhxiaofeng/azure-sdk-f…
Jul 30, 2024
c21c9ba
change auth model so remove some envVars
Aug 2, 2024
86431ae
update yml of formrecognizer
Aug 5, 2024
9ea20ff
update js text
Aug 6, 2024
1ea2eea
update js text default location
Aug 6, 2024
26ab0b5
fix conflict
Aug 27, 2024
30a2a18
restore resource file
Aug 29, 2024
bdf1b40
update
Aug 29, 2024
b5d73ea
Merge remote-tracking branch 'upstream/main' into sov-test
Sep 24, 2024
5ba6695
Merge branch 'sov-test' of https://github.com/zzhxiaofeng/azure-sdk-f…
Sep 24, 2024
7089ddf
Merge remote-tracking branch 'upstream/main' into sov-test
Oct 30, 2024
6c84800
fix pipeline fail
Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ describe("EventHubConsumerClient", () => {
});

await loopUntil({
maxTimes: 10,
maxTimes: 20,
name:
"Wait for subscription2 to read from all partitions and subscription1 to invoke close handlers",
timeBetweenRunsMs: 1000,
Expand Down
17 changes: 13 additions & 4 deletions sdk/eventhub/event-hubs/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ stages:
parameters:
PackageName: "@azure/event-hubs"
ServiceDirectory: eventhub
Clouds: 'Public,Canary'
TimeoutInMinutes: 120
SupportedClouds: 'Public,UsGov,China'
CloudConfig:
Public:
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
UsGov:
SubscriptionConfiguration: $(sub-config-gov-test-resources)
Location: 'usgovarizona'
China:
SubscriptionConfiguration: $(sub-config-cn-test-resources)
EnvVars:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_ID: $(EVENTHUB_CLIENT_ID)
AZURE_CLIENT_SECRET: $(EVENTHUB_CLIENT_SECRET)
AZURE_TENANT_ID: $(EVENTHUB_TENANT_ID)
AZURE_LOG_LEVEL: info
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ type MaybeTypedFormField<T extends FormField["valueType"]> =

matrix([[true, false]] as const, async (useAad) => {
describe(`[${useAad ? "AAD" : "API Key"}] FormRecognizerClient NodeJS only`, () => {
console.log("-----------------------------------1");
const aa = env.FORM_RECOGNIZER_ENDPOINT.toString();
for (var i = 0; i < aa.length; i++) {
console.log(aa[i]);
}
console.log("-----------------------------------2");
const bb = process.env["AZURE_TENANT_ID"]!.toString();
for (var i = 0; i < bb.length; i++) {
console.log(bb[i]);
}
console.log("-----------------------------------3");
const cc = process.env["TEST_MODE"]!.toString();
for (var i = 0; i < cc.length; i++) {
console.log(cc[i]);
}
console.log("-----------------------------------4");
const dd = process.env["FORM_RECOGNIZER_TARGET_RESOURCE_REGION"]!.toString();
for (var i = 0; i < dd.length; i++) {
console.log(dd[i]);
}
console.log("-----------------------------------5");

const ASSET_PATH = path.resolve(path.join(process.cwd(), "assets"));
let client: FormRecognizerClient;
let recorder: Recorder;
Expand Down
14 changes: 5 additions & 9 deletions sdk/formrecognizer/ai-form-recognizer/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
# specifying a different Azure region to use when manually triggering the live
# tests pipeline. This is useful for when we want to test in different
# environments: Prod, Canary, etc.
parameters:
- name: Location
displayName: Location
type: string
default: canadacentral

trigger: none

Expand All @@ -15,8 +10,9 @@ stages:
parameters:
PackageName: "@azure/ai-form-recognizer"
ServiceDirectory: formrecognizer
Location: "${{ parameters.Location }}"
TimeoutInMinutes: 120
SupportedClouds: 'Public,UsGov,China'
EnvVars:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_CLIENT_ID: $(FORMRECOGNIZER_CLIENT_ID)
AZURE_TENANT_ID: $(FORMRECOGNIZER_TENANT_ID)
AZURE_CLIENT_SECRET: $(FORMRECOGNIZER_CLIENT_SECRET)
8 changes: 6 additions & 2 deletions sdk/formrecognizer/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"blobResourceId": {
"type": "string",
"defaultValue": "[resourceId('2cd617ea-1866-46b1-90e3-fffb087ebf9b', 'TrainingData', 'Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]"
"defaultValue": "[resourceId('TrainingData', 'Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]"
},
"trainingDataSasProperties": {
"type": "object",
Expand Down Expand Up @@ -68,6 +68,10 @@
"signedPermission": "rl",
"signedResource": "c"
}
},
"cognitiveServicesEndpointSuffix": {
"type": "string",
"defaultValue": ".cognitiveservices.azure.com"
}
},
"variables": {
Expand Down Expand Up @@ -101,7 +105,7 @@
"outputs": {
"FORM_RECOGNIZER_ENDPOINT": {
"type": "string",
"value": "[concat('https://', parameters('baseName'), '.cognitiveservices.azure.com/')]"
"value": "[concat('https://', parameters('baseName'), parameters('cognitiveServicesEndpointSuffix'),'/')]"
},
"FORM_RECOGNIZER_API_KEY": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export const environmentSetup: RecorderEnvironmentSetup = {
};

export function createClients<IndexModel>(indexName: string): Clients<IndexModel> {
switch (testEnv.AZURE_AUTHORITY_HOST) {
case "https://login.microsoftonline.us":
process.env.ENDPOINT = process.env.ENDPOINT!.toString().replace(".windows.net", ".azure.us");
break;
case "https://login.chinacloudapi.cn":
process.env.ENDPOINT = process.env.ENDPOINT!.toString().replace(".windows.net", ".azure.cn");
break;
}

const credential = new AzureKeyCredential(testEnv.SEARCH_API_ADMIN_KEY);
const searchClient = new SearchClient<IndexModel>(testEnv.ENDPOINT, indexName, credential);
const indexClient = new SearchIndexClient(testEnv.ENDPOINT, credential);
Expand Down
1 change: 1 addition & 0 deletions sdk/search/search-documents/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ stages:
parameters:
PackageName: "@azure/search-documents"
ServiceDirectory: search
SupportedClouds: 'Public,UsGov,China'
4 changes: 2 additions & 2 deletions sdk/search/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
},
"searchSku": {
"type": "string",
"defaultValue": "free",
"defaultValue": "basic",
"metadata": {
"description": "SKU for search resource. The default is 'free'"
"description": "SKU for search resource. The default is 'basic'"
}
}
},
Expand Down
10 changes: 5 additions & 5 deletions sdk/servicebus/service-bus/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ stages:
parameters:
PackageName: "@azure/service-bus"
ServiceDirectory: servicebus
TimeoutInMinutes: 180
Clouds: 'Public,Canary'
TimeoutInMinutes: 120
SupportedClouds: 'Public,UsGov,China'
EnvVars:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_CLIENT_ID: $(SERVICEBUS_CLIENT_ID)
AZURE_TENANT_ID: $(SERVICEBUS_TENANT_ID)
AZURE_CLIENT_SECRET: $(SERVICEBUS_CLIENT_SECRET)
AZURE_SUBSCRIPTION_ID: $(test-subscription-id)
22 changes: 22 additions & 0 deletions sdk/textanalytics/ai-text-analytics/src/textAnalyticsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,14 @@ export class TextAnalyticsClient {
*/
private readonly client: GeneratedClient;

// isBrowser(): boolean {
// try {
// return typeof self !== "undefined";
// } catch (e) {
// return false;
// }
// }

/**
* Creates an instance of TextAnalyticsClient.
*
Expand Down Expand Up @@ -429,6 +437,20 @@ export class TextAnalyticsClient {

this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);

// let scopes;
// const env = this.isBrowser() ? (self as any).__env__ : process.env;

// switch (env["AZURE_AUTHORITY_HOST"]) {
// case "https://login.microsoftonline.us":
// scopes = "https://cognitiveservices.azure.us/.default";
// break;
// case "https://login.chinacloudapi.cn":
// scopes = "https://cognitiveservices.azure.cn/.default";
// break;
// default:
// scopes = DEFAULT_COGNITIVE_SCOPE;
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note this is not a reliable way to detect the scope based on #17563 (comment).

Copy link
Contributor Author

@zzhxiaofeng zzhxiaofeng Sep 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just my initial attempt, I have updated it to the original.


const authPolicy = isTokenCredential(credential)
? bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })
: textAnalyticsAzureKeyCredentialPolicy(credential);
Expand Down
8 changes: 5 additions & 3 deletions sdk/textanalytics/ai-text-analytics/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ stages:
parameters:
PackageName: "@azure/ai-text-analytics"
ServiceDirectory: textanalytics
TimeoutInMinutes: 180
SupportedClouds: 'Public,UsGov,China'
EnvVars:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
AZURE_CLIENT_ID: $(TEXTANALYTICS_CLIENT_ID)
AZURE_TENANT_ID: $(TEXTANALYTICS_TENANT_ID)
AZURE_CLIENT_SECRET: $(TEXTANALYTICS_CLIENT_SECRET)