Skip to content

Commit 6aadaf0

Browse files
authored
Merge pull request #3098 from microsoftgraph/2997-msgraph-and-az-module-are-not-compatible
Bumps versions for Azure.Identity, Azure.Identity.Broker and Microsoft.Graph.Core
2 parents be9e661 + 3d1baae commit 6aadaf0

File tree

7 files changed

+21
-24
lines changed

7 files changed

+21
-24
lines changed

.azure-pipelines/common-templates/install-tools.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ steps:
55
- task: UseDotNet@2
66
displayName: Use .NET SDK
77
inputs:
8-
debugMode: false
9-
version: 8.x
10-
8+
version: 8.x
9+
1110
- task: NuGetToolInstaller@1
1211
displayName: Install Nuget
1312

src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
<Import Project="$(MSBuildThisFileDirectory)..\..\..\Repo.props" />
33
<PropertyGroup>
44
<LangVersion>9.0</LangVersion>
5-
<TargetFrameworks>netstandard2.0;net6.0;net472</TargetFrameworks>
5+
<TargetFrameworks>netstandard2.0;net8.0;net472</TargetFrameworks>
66
<RootNamespace>Microsoft.Graph.PowerShell.Authentication.Core</RootNamespace>
7-
<Version>2.18.0</Version>
7+
<Version>2.25.0</Version>
8+
<!-- Suppress .NET Target Framework Moniker (TFM) Support Build Warnings -->
9+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
810
</PropertyGroup>
911
<PropertyGroup>
1012
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1113
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1214
</PropertyGroup>
1315
<ItemGroup>
14-
<PackageReference Include="Azure.Identity" Version="1.11.4" />
15-
<PackageReference Include="Azure.Identity.Broker" Version="1.1.0" />
16-
<PackageReference Include="Microsoft.Graph.Core" Version="3.1.13" />
16+
<PackageReference Include="Azure.Identity" Version="1.13.2" />
17+
<PackageReference Include="Azure.Identity.Broker" Version="1.2.0" />
18+
<PackageReference Include="Microsoft.Graph.Core" Version="3.2.2" />
1719
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1820
<PackageReference Include="System.Text.Json" Version="8.0.5" />
1921
</ItemGroup>

src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ private static async Task<TokenCredential> GetEnvironmentCredentialAsync(IAuthCo
6060
{
6161
if (authContext is null)
6262
throw new AuthenticationException(ErrorConstants.Message.MissingAuthContext);
63-
63+
//There is need for explicitly adding TenantId to the TokenCredentialOptions for EnvironmentCredential due to stricter security requirements.
64+
authContext.TenantId = EnvironmentVariables.TenantId;
6465
var tokenCredentialOptions = new TokenCredentialOptions
6566
{
6667
AuthorityHost = new Uri(GetAuthorityUrl(authContext))
@@ -207,8 +208,8 @@ public static async Task<AzureIdentityAccessTokenProvider> GetAuthenticationProv
207208
{
208209
if (authContext is null)
209210
throw new AuthenticationException(ErrorConstants.Message.MissingAuthContext);
210-
var tokenCrdential = await GetTokenCredentialAsync(authContext, default).ConfigureAwait(false);
211-
return new AzureIdentityAccessTokenProvider(credential: tokenCrdential, scopes: GetScopes(authContext));
211+
var tokenCredential = await GetTokenCredentialAsync(authContext, default).ConfigureAwait(false);
212+
return new AzureIdentityAccessTokenProvider(credential:tokenCredential, observabilityOptions: null,isCaeEnabled: true,scopes: GetScopes(authContext));
212213
}
213214

214215
public static async Task<IAuthContext> AuthenticateAsync(IAuthContext authContext, CancellationToken cancellationToken)

src/Authentication/Authentication.Test/Microsoft.Graph.Authentication.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net472</TargetFrameworks>
3+
<TargetFrameworks>net8.0;net472</TargetFrameworks>
44
<IsPackable>false</IsPackable>
5-
<Version>2.8.0</Version>
5+
<Version>2.25.0</Version>
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
99
<!-- As described in this post https://devblogs.microsoft.com/powershell/depending-on-the-right-powershell-nuget-package-in-your-net-project, reference the SDK for dotnetcore-->
10-
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.4.3" PrivateAssets="all" Condition="'$(TargetFramework)' == 'net6.0'" />
10+
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.0" PrivateAssets="all" Condition="'$(TargetFramework)' == 'net8.0'" />
1111
<PackageReference Include="Moq" Version="4.20.70" />
1212
<PackageReference Include="xunit" Version="2.4.2" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

src/Authentication/Authentication/Helpers/HttpHelpers.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ private static HttpClient GetGraphHttpClient(AzureIdentityAccessTokenProvider au
5454
new NationalCloudHandler(),
5555
new ODataQueryOptionsHandler(),
5656
new HttpVersionHandler(),
57-
new CompressionHandler(),
5857
new RetryHandler(new RetryHandlerOption{
5958
Delay = requestContext.RetryDelay,
6059
MaxRetry = requestContext.MaxRetry,
@@ -69,7 +68,7 @@ private static HttpClient GetGraphHttpClient(AzureIdentityAccessTokenProvider au
6968
: GraphClientFactory.Create(delegatingHandlers, finalHandler: new HttpClientHandler
7069
{
7170
AllowAutoRedirect = false,
72-
AutomaticDecompression = DecompressionMethods.None
71+
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
7372
});
7473
httpClient.Timeout = requestContext.ClientTimeout;
7574
return httpClient;

src/Authentication/Authentication/build-module.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $ErrorActionPreference = 'Stop'
88
$ModuleName = "Authentication"
99
$ModulePrefix = "Microsoft.Graph"
1010
$netStandard = "netstandard2.0"
11-
$netApp = "net6.0"
11+
$netApp = "net8.0"
1212
$netFx = "net472"
1313
$copyExtensions = @('.dll', '.pdb')
1414

src/Authentication/Authentication/test/Connect-MgGraph.Tests.ps1

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ BeforeAll {
77
$ModulePath = Join-Path $PSScriptRoot "..\artifacts\$ModuleName.psd1"
88
Import-Module $ModulePath -Force
99
$RandomClientId = (New-Guid).Guid
10-
11-
$AvailableAzModule = Get-Module Az.Accounts -ListAvailable
12-
if ($AvailableAzModule.Count -lt 1) {
13-
Install-Module Az.Accounts -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
14-
}
10+
Install-Module Az.Accounts -Repository PSGallery -Scope CurrentUser -Force -AllowClobber
1511
}
1612
Describe 'Connect-MgGraph ParameterSets' {
1713
BeforeAll {
@@ -81,7 +77,7 @@ Describe 'Connect-MgGraph In Environment Variable Mode' {
8177
$Env:AZURE_CLIENT_SECRET = "Not_Valid"
8278
$Env:AZURE_TENANT_ID = "common"
8379
Connect-MgGraph -EnvironmentVariable -ErrorAction Stop
84-
} | Should -Throw -ExpectedMessage "*ClientSecretCredential authentication failed: AADSTS700016: Application with identifier 'Not_Valid' was not found in the directory 'Microsoft'.*"
80+
} | Should -Throw -ExpectedMessage "ClientSecretCredential authentication failed: "
8581
}
8682
}
8783

@@ -99,7 +95,7 @@ Describe 'Connect-MgGraph In App Mode' {
9995
Describe 'Connect-MgGraph Dependency Resolution' {
10096
It 'Should load Mg module side by side with Az module.' {
10197
{ Connect-AzAccount -ApplicationId $RandomClientId -CertificateThumbprint "Invalid" -Tenant "Invalid" -ErrorAction Stop } | Should -Throw -ExpectedMessage "*Could not find tenant id*"
102-
{ Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -ErrorAction Stop -UseDeviceAuthentication } | Should -Throw -ExpectedMessage "*AADSTS90002*"
98+
{ Connect-MgGraph -TenantId "thisdomaindoesnotexist.com" -ErrorAction Stop -UseDeviceAuthentication } | Should -Throw -ExpectedMessage "DeviceCodeCredential authentication failed: "
10399
}
104100
}
105101

0 commit comments

Comments
 (0)