Skip to content

Commit dc1d26d

Browse files
authored
Updated key
Changing all authentication variables to environment variables with standard naming.
1 parent c4016ef commit dc1d26d

File tree

1 file changed

+3
-7
lines changed
  • Search/BingWebSearch/src/main/java/com/microsoft/azure/cognitiveservices/search/websearch/samples

1 file changed

+3
-7
lines changed

Search/BingWebSearch/src/main/java/com/microsoft/azure/cognitiveservices/search/websearch/samples/BingWebSearchSample.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,10 @@ public static void main(String[] args) {
121121
try {
122122
//=============================================================
123123
// Authenticate
124-
125-
// If you are going to set the AZURE_BING_SAMPLES_API_KEY environment variable, make sure you set it for your OS, then reopen your command prompt or IDE.
126-
// If not, you may get an API key not found exception.
124+
// Set the BING_SEARCH_V7_SUBSCRIPTION_KEY environment variable with your subscription key,
125+
// then reopen your command prompt or IDE. If not, you may get an API key not found exception.
127126
// IMPORTANT: if you have not set the `AZURE_BING_SAMPLES_API_KEY` environment variable to your cognitive services API key:
128-
// 1. comment out the below line
129-
final String subscriptionKey = System.getenv("AZURE_BING_SAMPLES_API_KEY");
130-
// 2. paste your cognitive services API key below, and uncomment the line
131-
//final String subscriptionKey = "enter your key here";
127+
final String subscriptionKey = System.getenv("BING_SEARCH_V7_SUBSCRIPTION_KEY");
132128

133129
BingWebSearchAPI client = BingWebSearchManager.authenticate(subscriptionKey);
134130

0 commit comments

Comments
 (0)