Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sdk/PnP.Core.Auth/PnP.Core.Auth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Identity.Client" Version="4.73.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.82.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

Expand Down
28 changes: 19 additions & 9 deletions src/sdk/PnP.Core.Test/Misc/CloudManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static void TestFixtureSetup(TestContext context)

[TestMethod()]
[DataRow("https://bertonline.sharepoint.com/sites/prov-2", Microsoft365Environment.Production)]
[DataRow("https://bertonline.sharepoint.de/sites/prov-2", Microsoft365Environment.Germany)]
[DataRow("https://bertonline.sharepoint.de/sites/prov-2", Microsoft365Environment.DelosCloud)]
[DataRow("https://bertonline.sharepoint.cn/sites/prov-2", Microsoft365Environment.China)]
[DataRow("https://bertonline.sharepoint.us/sites/prov-2", Microsoft365Environment.USGovernment)]
[DataRow("https://bertonline.sharepoint.oops/sites/prov-2", Microsoft365Environment.Production)]
Expand All @@ -33,11 +33,13 @@ public void UriToMicrosoft365Environment(string url, Microsoft365Environment exp
[TestMethod()]
[DataRow("graph.microsoft.com", Microsoft365Environment.Production)]
[DataRow("graph.microsoft.com", Microsoft365Environment.PreProduction)]
[DataRow("graph.microsoft.com", Microsoft365Environment.USGovernment)]
[DataRow("graph.microsoft.de", Microsoft365Environment.Germany)]
[DataRow("graph.microsoft.com", Microsoft365Environment.USGovernment)]
[DataRow("microsoftgraph.chinacloudapi.cn", Microsoft365Environment.China)]
[DataRow("graph.microsoft.us", Microsoft365Environment.USGovernmentHigh)]
[DataRow("dod-graph.microsoft.us", Microsoft365Environment.USGovernmentDoD)]
[DataRow("graph.svc.sovcloud.fr", Microsoft365Environment.BleuCloud)]
[DataRow("graph.svc.sovcloud.de", Microsoft365Environment.DelosCloud)]
[DataRow("graph.svc.sovcloud.sg", Microsoft365Environment.GovSGCloud)]
Comment on lines 33 to +42
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests were updated to remove Germany coverage and replace .de with DelosCloud. Since Microsoft365Environment.Germany still exists, this leaves its authority/base-URI behavior untested (and currently it falls back to production due to missing mappings). Either restore tests for Germany or remove/deprecate the enum value so the supported surface matches the test suite.

Copilot uses AI. Check for mistakes.
public void Microsoft365EnvironmentToGraph(string graph, Microsoft365Environment env)
{
Assert.AreEqual(graph, CloudManager.GetMicrosoftGraphAuthority(env));
Expand All @@ -46,11 +48,13 @@ public void Microsoft365EnvironmentToGraph(string graph, Microsoft365Environment
[TestMethod()]
[DataRow("login.microsoftonline.com", Microsoft365Environment.Production)]
[DataRow("login.windows-ppe.net", Microsoft365Environment.PreProduction)]
[DataRow("login.microsoftonline.com", Microsoft365Environment.USGovernment)]
[DataRow("login.microsoftonline.de", Microsoft365Environment.Germany)]
[DataRow("login.microsoftonline.com", Microsoft365Environment.USGovernment)]
[DataRow("login.chinacloudapi.cn", Microsoft365Environment.China)]
[DataRow("login.microsoftonline.us", Microsoft365Environment.USGovernmentHigh)]
[DataRow("login.microsoftonline.us", Microsoft365Environment.USGovernmentDoD)]
[DataRow("login.sovcloud-identity.fr", Microsoft365Environment.BleuCloud)]
[DataRow("login.sovcloud-identity.de", Microsoft365Environment.DelosCloud)]
[DataRow("login.sovcloud-identity.sg", Microsoft365Environment.GovSGCloud)]
public void Microsoft365EnvironmentToAzureADLogin(string azureADLogin, Microsoft365Environment env)
{
Assert.AreEqual(azureADLogin, CloudManager.GetAzureADLoginAuthority(env));
Expand All @@ -73,10 +77,7 @@ public async Task Microsoft365EnvironmentToGraphUri()
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.microsoft.com"));

context.Environment = Microsoft365Environment.USGovernment;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.microsoft.com"));

context.Environment = Microsoft365Environment.Germany;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.microsoft.de"));
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.microsoft.com"));

context.Environment = Microsoft365Environment.China;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://microsoftgraph.chinacloudapi.cn"));
Comment on lines +73 to 83
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft365EnvironmentToGraphUri no longer asserts behavior for Microsoft365Environment.Germany, but the enum value still exists. This makes it easy for a regression (or unintended fallback to production) to ship unnoticed. Either add back an assertion for Germany or explicitly deprecate/remove the enum value.

Copilot uses AI. Check for mistakes.
Expand All @@ -87,6 +88,15 @@ public async Task Microsoft365EnvironmentToGraphUri()
context.Environment = Microsoft365Environment.USGovernmentDoD;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://dod-graph.microsoft.us"));

context.Environment = Microsoft365Environment.BleuCloud;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.svc.sovcloud.fr"));

context.Environment = Microsoft365Environment.DelosCloud;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.svc.sovcloud.de"));

context.Environment = Microsoft365Environment.GovSGCloud;
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.svc.sovcloud.sg"));

context.Environment = Microsoft365Environment.Custom;
context.MicrosoftGraphAuthority = "graph.microsoft.be";
Assert.AreEqual(CloudManager.GetGraphBaseUri(context), new Uri($"https://graph.microsoft.be"));
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/PnP.Core.Test/PnP.Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.73.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.82.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
Expand Down
16 changes: 11 additions & 5 deletions src/sdk/PnP.Core/Services/Core/CloudManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ internal static Microsoft365Environment GetEnvironmentFromUri(Uri url)
{
"com" => Microsoft365Environment.Production,
"us" => Microsoft365Environment.USGovernment,
"de" => Microsoft365Environment.Germany,
"de" => Microsoft365Environment.DelosCloud,
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetEnvironmentFromUri now maps the .de TLD to DelosCloud, but the enum still contains Microsoft365Environment.Germany (documented as Office 365 Germany). This silently changes environment detection for existing .sharepoint.de tenants. Either keep mapping .de to Germany, or explicitly deprecate/remove Germany and document that .de is now treated as DelosCloud (potential breaking change).

Suggested change
"de" => Microsoft365Environment.DelosCloud,
"de" => Microsoft365Environment.Germany,

Copilot uses AI. Check for mistakes.
"cn" => Microsoft365Environment.China,
"fr" => Microsoft365Environment.BleuCloud,
"sg" => Microsoft365Environment.GovSGCloud,
_ => Microsoft365Environment.Production,
};
}
Expand All @@ -32,9 +34,11 @@ internal static string GetMicrosoftGraphAuthority(Microsoft365Environment enviro
Microsoft365Environment.PreProduction => "graph.microsoft.com",
Microsoft365Environment.USGovernment => "graph.microsoft.com",
Microsoft365Environment.USGovernmentHigh => "graph.microsoft.us",
Microsoft365Environment.USGovernmentDoD => "dod-graph.microsoft.us",
Microsoft365Environment.Germany => "graph.microsoft.de",
Microsoft365Environment.USGovernmentDoD => "dod-graph.microsoft.us",
Microsoft365Environment.China => "microsoftgraph.chinacloudapi.cn",
Microsoft365Environment.BleuCloud => "graph.svc.sovcloud.fr",
Microsoft365Environment.DelosCloud => "graph.svc.sovcloud.de",
Microsoft365Environment.GovSGCloud => "graph.svc.sovcloud.sg",
_ => "graph.microsoft.com"
Comment on lines +31 to 42
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft365Environment.Germany is still a valid enum value, but GetMicrosoftGraphAuthority no longer has a case for it, so it will fall back to the production authority. If Germany is still supported, add an explicit mapping (and keep/adjust tests). If it’s intentionally retired, consider marking the enum value [Obsolete] (or removing it in a major version) to avoid surprising behavior.

Copilot uses AI. Check for mistakes.
};
}
Expand All @@ -53,9 +57,11 @@ internal static string GetAzureADLoginAuthority(Microsoft365Environment environm
Microsoft365Environment.PreProduction => "login.windows-ppe.net",
Microsoft365Environment.USGovernment => "login.microsoftonline.com",
Microsoft365Environment.USGovernmentHigh => "login.microsoftonline.us",
Microsoft365Environment.USGovernmentDoD => "login.microsoftonline.us",
Microsoft365Environment.Germany => "login.microsoftonline.de",
Microsoft365Environment.USGovernmentDoD => "login.microsoftonline.us",
Microsoft365Environment.China => "login.chinacloudapi.cn",
Microsoft365Environment.BleuCloud => "login.sovcloud-identity.fr",
Microsoft365Environment.DelosCloud => "login.sovcloud-identity.de",
Microsoft365Environment.GovSGCloud => "login.sovcloud-identity.sg",
_ => "login.microsoftonline.com"
Comment on lines +54 to 65
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Microsoft365Environment.Germany is still present in the enum, but GetAzureADLoginAuthority no longer maps it and will default to login.microsoftonline.com. If Germany is still a supported environment, add the missing mapping (and tests). If it’s deprecated, mark it as such so callers don’t unknowingly authenticate against the wrong authority.

Copilot uses AI. Check for mistakes.
};
}
Expand Down
15 changes: 15 additions & 0 deletions src/sdk/PnP.Core/Services/Core/Microsoft365Environment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ public enum Microsoft365Environment
/// </summary>
USGovernmentDoD = 6,

/// <summary>
/// French sovereign cloud environment,A joint venture between Orange and Capgemini, designed to meet SecNumCloud requirements , see https://learn.microsoft.com/en-us/industry/sovereign-cloud/national-partner-clouds/overview-national-partner-clouds
/// </summary>
BleuCloud = 7,

/// <summary>
/// Represents the Delos Cloud environment option. Operated by an SAP subsidiary, aligned with German Cloud Platform Requirements, see see https://learn.microsoft.com/en-us/industry/sovereign-cloud/national-partner-clouds/overview-national-partner-clouds
/// </summary>
Comment thread
gautamdsheth marked this conversation as resolved.
Outdated
DelosCloud = 8,

/// <summary>
/// Represents the GovSG Cloud environment option. Operated by a Singaporean government-owned company, aligned with Singapore's Sovereign Cloud Framework, see https://learn.microsoft.com/en-us/industry/sovereign-cloud/national-partner-clouds/overview-national-partner-clouds
Comment thread
gautamdsheth marked this conversation as resolved.
Outdated
/// </summary>
GovSGCloud = 9,

/// <summary>
/// Custom cloud configuration, specify the endpoints manually
/// </summary>
Expand Down
Loading