diff --git a/.azure-pipelines/common-templates/install-tools.yml b/.azure-pipelines/common-templates/install-tools.yml
index ec31ddc50a..1a1d771bce 100644
--- a/.azure-pipelines/common-templates/install-tools.yml
+++ b/.azure-pipelines/common-templates/install-tools.yml
@@ -5,9 +5,8 @@ steps:
- task: UseDotNet@2
displayName: Use .NET SDK
inputs:
- debugMode: false
- version: 8.x
-
+ version: 8.x
+
- task: NuGetToolInstaller@1
displayName: Install Nuget
diff --git a/src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj b/src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj
index d1f74e2c15..bcce1da629 100644
--- a/src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj
+++ b/src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj
@@ -2,18 +2,20 @@
9.0
- netstandard2.0;net6.0;net472
+ netstandard2.0;net8.0;net472
Microsoft.Graph.PowerShell.Authentication.Core
- 2.18.0
+ 2.25.0
+
+ true
true
true
-
-
-
+
+
+
diff --git a/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs b/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs
index 3d00433610..71919594c4 100644
--- a/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs
+++ b/src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs
@@ -60,7 +60,8 @@ private static async Task GetEnvironmentCredentialAsync(IAuthCo
{
if (authContext is null)
throw new AuthenticationException(ErrorConstants.Message.MissingAuthContext);
-
+ //There is need for explicitly adding TenantId to the TokenCredentialOptions for EnvironmentCredential due to stricter security requirements.
+ authContext.TenantId = EnvironmentVariables.TenantId;
var tokenCredentialOptions = new TokenCredentialOptions
{
AuthorityHost = new Uri(GetAuthorityUrl(authContext))
@@ -207,8 +208,8 @@ public static async Task GetAuthenticationProv
{
if (authContext is null)
throw new AuthenticationException(ErrorConstants.Message.MissingAuthContext);
- var tokenCrdential = await GetTokenCredentialAsync(authContext, default).ConfigureAwait(false);
- return new AzureIdentityAccessTokenProvider(credential: tokenCrdential, scopes: GetScopes(authContext));
+ var tokenCredential = await GetTokenCredentialAsync(authContext, default).ConfigureAwait(false);
+ return new AzureIdentityAccessTokenProvider(credential:tokenCredential, observabilityOptions: null,isCaeEnabled: true,scopes: GetScopes(authContext));
}
public static async Task AuthenticateAsync(IAuthContext authContext, CancellationToken cancellationToken)
diff --git a/src/Authentication/Authentication.Test/Microsoft.Graph.Authentication.Test.csproj b/src/Authentication/Authentication.Test/Microsoft.Graph.Authentication.Test.csproj
index 8f6dc50c09..f40643cfdb 100644
--- a/src/Authentication/Authentication.Test/Microsoft.Graph.Authentication.Test.csproj
+++ b/src/Authentication/Authentication.Test/Microsoft.Graph.Authentication.Test.csproj
@@ -1,13 +1,13 @@
- net6.0;net472
+ net8.0;net472
false
- 2.8.0
+ 2.25.0
-
+
diff --git a/src/Authentication/Authentication/Helpers/HttpHelpers.cs b/src/Authentication/Authentication/Helpers/HttpHelpers.cs
index cfd9252f5f..e54612ba0b 100644
--- a/src/Authentication/Authentication/Helpers/HttpHelpers.cs
+++ b/src/Authentication/Authentication/Helpers/HttpHelpers.cs
@@ -54,7 +54,6 @@ private static HttpClient GetGraphHttpClient(AzureIdentityAccessTokenProvider au
new NationalCloudHandler(),
new ODataQueryOptionsHandler(),
new HttpVersionHandler(),
- new CompressionHandler(),
new RetryHandler(new RetryHandlerOption{
Delay = requestContext.RetryDelay,
MaxRetry = requestContext.MaxRetry,
@@ -69,7 +68,7 @@ private static HttpClient GetGraphHttpClient(AzureIdentityAccessTokenProvider au
: GraphClientFactory.Create(delegatingHandlers, finalHandler: new HttpClientHandler
{
AllowAutoRedirect = false,
- AutomaticDecompression = DecompressionMethods.None
+ AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
httpClient.Timeout = requestContext.ClientTimeout;
return httpClient;
diff --git a/src/Authentication/Authentication/build-module.ps1 b/src/Authentication/Authentication/build-module.ps1
index 44d580f400..85edb194e0 100644
--- a/src/Authentication/Authentication/build-module.ps1
+++ b/src/Authentication/Authentication/build-module.ps1
@@ -8,7 +8,7 @@ $ErrorActionPreference = 'Stop'
$ModuleName = "Authentication"
$ModulePrefix = "Microsoft.Graph"
$netStandard = "netstandard2.0"
-$netApp = "net6.0"
+$netApp = "net8.0"
$netFx = "net472"
$copyExtensions = @('.dll', '.pdb')
diff --git a/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1 b/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1
index 6f88feddf0..382ad62a98 100644
--- a/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1
+++ b/src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1
@@ -7,11 +7,7 @@ BeforeAll {
$ModulePath = Join-Path $PSScriptRoot "..\artifacts\$ModuleName.psd1"
Import-Module $ModulePath -Force
$RandomClientId = (New-Guid).Guid
-
- $AvailableAzModule = Get-Module Az.Accounts -ListAvailable
- if ($AvailableAzModule.Count -lt 1) {
- Install-Module Az.Accounts -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
- }
+ Install-Module Az.Accounts -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
}
Describe 'Connect-MgGraph ParameterSets' {
BeforeAll {
@@ -81,7 +77,7 @@ Describe 'Connect-MgGraph In Environment Variable Mode' {
$Env:AZURE_CLIENT_SECRET = "Not_Valid"
$Env:AZURE_TENANT_ID = "common"
Connect-MgGraph -EnvironmentVariable -ErrorAction Stop
- } | Should -Throw -ExpectedMessage "*ClientSecretCredential authentication failed: AADSTS700016: Application with identifier 'Not_Valid' was not found in the directory 'Microsoft'.*"
+ } | Should -Throw -ExpectedMessage "ClientSecretCredential authentication failed: "
}
}
@@ -99,7 +95,7 @@ Describe 'Connect-MgGraph In App Mode' {
Describe 'Connect-MgGraph Dependency Resolution' {
It 'Should load Mg module side by side with Az module.' {
{ Connect-AzAccount -ApplicationId $RandomClientId -CertificateThumbprint "Invalid" -Tenant "Invalid" -ErrorAction Stop } | Should -Throw -ExpectedMessage "*Could not find tenant id*"
- { Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -ErrorAction Stop -UseDeviceAuthentication } | Should -Throw -ExpectedMessage "*AADSTS90002*"
+ { Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -ErrorAction Stop -UseDeviceAuthentication } | Should -Throw -ExpectedMessage "DeviceCodeCredential authentication failed: "
}
}