Skip to content

Commit 910cc89

Browse files
authored
Merge pull request #102429 from KingdomOfEnds/tsi-refresh
corrected code sample
2 parents efd6398 + f2b0807 commit 910cc89

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

articles/time-series-insights/time-series-insights-manage-reference-data-csharp.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: cshankar
99
ms.devlang: csharp
1010
ms.workload: big-data
1111
ms.topic: conceptual
12-
ms.date: 01/16/2020
12+
ms.date: 01/27/2020
1313
ms.custom: seodec18
1414
---
1515

@@ -111,11 +111,12 @@ namespace CsharpTsiMsalGaSample
111111
internal static string AadClientApplicationId = "#PLACEHOLDER#";
112112
internal static string[] AadScopes = new string[] { "https://api.timeseries.azure.com//user_impersonation" };
113113
internal static string AadRedirectUri = "http://localhost:8080/";
114-
internal static string AadAuthenticationAuthority = "https://login.microsoftonline.com/microsoft.onmicrosoft.com/oauth2/authorize?resource=https://api.timeseries.azure.com/";
114+
internal static string AadTenantName = "#PLACEHOLDER#";
115+
internal static string AadAuthenticationAuthority = "https://login.microsoftonline.com/" + AadTenantName + ".onmicrosoft.com/oauth2/authorize?resource=https://api.timeseries.azure.com/";
115116

116117
private static async Task<string> AcquireAccessTokenAsync()
117118
{
118-
if (AadClientApplicationId == "#PLACEHOLDER#" || AadScopes.Length == 0 || AadRedirectUri == "#PLACEHOLDER#" || AadAuthenticationAuthority.StartsWith("#PLACEHOLDER#"))
119+
if (AadClientApplicationId == "#PLACEHOLDER#" || AadScopes.Length == 0 || AadRedirectUri == "#PLACEHOLDER#" || AadTenantName.StartsWith("#PLACEHOLDER#"))
119120
{
120121
throw new Exception($"Use the link {"https://docs.microsoft.com/azure/time-series-insights/time-series-insights-get-started"} to update the values of 'AadClientApplicationId', 'AadScopes', 'AadRedirectUri', and 'AadAuthenticationAuthority'.");
121122
}
@@ -144,7 +145,7 @@ namespace CsharpTsiMsalGaSample
144145
// System.Net.HttpClient helper to wrap HTTP POST made to the GA Reference Data API
145146
private static async Task<HttpResponseMessage> AsyncHttpPostRequestHelper(HttpClient httpClient, string input)
146147
{
147-
if (EnvironmentFqdn == "#PLACEHOLDER#" || EnvironmentReferenceDataSetName == "#PLACEHOLDER#")
148+
if (EnvironmentFqdn.StartsWith("#PLACEHOLDER#") || EnvironmentReferenceDataSetName == "#PLACEHOLDER#")
148149
{
149150
throw new Exception($"Use the link {"https://docs.microsoft.com/azure/time-series-insights/time-series-insights-authentication-and-authorization"} to update the values of 'EnvironmentFqdn' and 'EnvironmentReferenceDataSetName'.");
150151
}

0 commit comments

Comments
 (0)