diff --git a/src/sdk/PnP.Core/Services/Core/PnPContext.cs b/src/sdk/PnP.Core/Services/Core/PnPContext.cs index 10c1636b00..6f0517cfca 100644 --- a/src/sdk/PnP.Core/Services/Core/PnPContext.cs +++ b/src/sdk/PnP.Core/Services/Core/PnPContext.cs @@ -808,7 +808,8 @@ internal async Task SetAADTenantId() { if (GlobalOptions.AADTenantId == Guid.Empty && Uri != null) { - using (var request = new HttpRequestMessage(HttpMethod.Get, $"{Uri}/_vti_bin/client.svc")) + // Hit client.svc on the root site collection to avoid being redirected there + using (var request = new HttpRequestMessage(HttpMethod.Get, $"{Uri.Scheme }://{Uri.DnsSafeHost}/_vti_bin/client.svc")) { request.Headers.Add("Authorization", "Bearer"); HttpResponseMessage response = await httpClient.SendAsync(request).ConfigureAwait(false);