Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit f29cc5c

Browse files
authored
feat: add national clouds support (#423)
1 parent f5eb478 commit f29cc5c

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,18 @@ static IHostBuilder CreateHostBuilder(string[] args) =>
196196
GraphServiceLibraryClientVersion = $"{assemblyVersion?.Major ?? 0}.{assemblyVersion?.Minor ?? 0}.{assemblyVersion?.Build ?? 0}",
197197
GraphServiceTargetVersion = "1.0"
198198
};
199+
200+
var authSettings = p.GetRequiredService<IOptions<AuthenticationOptions>>().Value;
199201
var headersHandler = new NativeHttpHeadersHandler(() => InMemoryHeadersStore.Instance, p.GetService<ILogger<NativeHttpHeadersHandler>>());
200-
return GraphCliClientFactory.GetDefaultClient(options, loggingHandler: p.GetRequiredService<LoggingHandler>(), middlewares: new[] { headersHandler });
202+
203+
return GraphCliClientFactory.GetDefaultClient(options, environment: authSettings.Environment, loggingHandler: p.GetRequiredService<LoggingHandler>(), middlewares: new[] { headersHandler });
201204
});
202205
services.AddSingleton<IAuthenticationProvider>(p =>
203206
{
204207
var authSettings = p.GetRequiredService<IOptions<AuthenticationOptions>>()?.Value;
205208
var serviceFactory = p.GetRequiredService<AuthenticationServiceFactory>();
206209
AuthenticationStrategy authStrategy = authSettings?.Strategy ?? AuthenticationStrategy.DeviceCode;
207-
var credential = serviceFactory.GetTokenCredentialAsync(authStrategy, authSettings?.TenantId, authSettings?.ClientId, authSettings?.ClientCertificateName, authSettings?.ClientCertificateThumbPrint);
210+
var credential = serviceFactory.GetTokenCredentialAsync(authStrategy, authSettings?.TenantId, authSettings?.ClientId, authSettings?.ClientCertificateName, authSettings?.ClientCertificateThumbPrint, authSettings?.Environment ?? CloudEnvironment.Global);
208211
credential.Wait();
209212
var client = p.GetRequiredService<HttpClient>();
210213
return new AzureIdentityAuthenticationProvider(credential.Result);

src/msgraph-cli.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
5858
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
5959
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
60-
<PackageReference Include="Microsoft.Graph.Cli.Core" Version="1.1.0" />
60+
<PackageReference Include="Microsoft.Graph.Cli.Core" Version="1.2.0" />
6161
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
6262
</ItemGroup>
6363

src/packages.lock.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@
4141
},
4242
"Microsoft.Graph.Cli.Core": {
4343
"type": "Direct",
44-
"requested": "[1.1.0, )",
45-
"resolved": "1.1.0",
46-
"contentHash": "VrH8RwpL4bX8JDN5g+B5H7WG0bQHoy/XZMxHCi5tsU3PnN9GQaCBimXmrhgZqTPtUQc1FN0RWcihRBsGP9LfHA==",
44+
"requested": "[1.2.0, )",
45+
"resolved": "1.2.0",
46+
"contentHash": "NVLBQJI6fv7WOQIxj+g11cq2GTPtcwWyp0X6G8TReeLhkB2dnxmj/mrMUjW8f6KjYllwPPk0dMXlOAmB8Zo9rQ==",
4747
"dependencies": {
4848
"Azure.Identity": "1.10.4",
4949
"JmesPath.Net": "1.0.330",
5050
"Microsoft.Extensions.Hosting": "8.0.0",
5151
"Microsoft.Extensions.Http": "8.0.0",
52-
"Microsoft.Graph.Core": "3.1.5",
52+
"Microsoft.Graph.Core": "3.1.6",
5353
"Microsoft.Kiota.Cli.Commons": "1.1.0",
54-
"Microsoft.Kiota.Http.HttpClientLibrary": "1.3.4",
54+
"Microsoft.Kiota.Http.HttpClientLibrary": "1.3.5",
5555
"Spectre.Console": "0.48.0",
5656
"System.CommandLine": "2.0.0-beta4.22272.1"
5757
}
@@ -386,8 +386,8 @@
386386
},
387387
"Microsoft.Graph.Core": {
388388
"type": "Transitive",
389-
"resolved": "3.1.5",
390-
"contentHash": "rqAnJvO+yI/SsJKlW2XxNtHofs9DvR4EYPs+b1vx5rxEGZ8MnaMgzpeffgjjLzWZzhoqzfKzyzo0dvC8l6SD2Q==",
389+
"resolved": "3.1.6",
390+
"contentHash": "tOR7lYGMtU3jLYsE2omp8iL8uIMrui7/A90cq/sQnrZo1X9DN6C1UuaMUUcE7Txnu+jUE1tmupbaJEjEKSsd6Q==",
391391
"dependencies": {
392392
"Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.2.0",
393393
"Microsoft.Kiota.Abstractions": "1.7.5",
@@ -468,8 +468,8 @@
468468
},
469469
"Microsoft.Kiota.Abstractions": {
470470
"type": "Transitive",
471-
"resolved": "1.7.5",
472-
"contentHash": "6oAk4nq/lnyPOmILshB8P6w9Q2X5H4Z7hGBT+Lbuusr+FnxzO6gb7BY50KY7+buiirCi4U90juk6WcXiY7SN3w==",
471+
"resolved": "1.7.7",
472+
"contentHash": "Q7BqdIOlW/QSdNPg5M1pqwZLPkkT2zZfcS9+Q5S61S35Thj9eyJ1GmDagdCQzlBojlGwJgjUUuRQyWTZ+nHmMQ==",
473473
"dependencies": {
474474
"Std.UriTemplate": "0.0.50",
475475
"System.Diagnostics.DiagnosticSource": "[6.0.0, 9.0.0)"
@@ -500,10 +500,10 @@
500500
},
501501
"Microsoft.Kiota.Http.HttpClientLibrary": {
502502
"type": "Transitive",
503-
"resolved": "1.3.4",
504-
"contentHash": "UDIdHI97FL6aJFEEqI3UL0R8JzYnu0wRtP0UwfKMcldLA3JF1p8lhocn0yll5ZUb2cxpmFOVxX6kJiHEh+8V1w==",
503+
"resolved": "1.3.5",
504+
"contentHash": "Oci74Lr1tjAJy4jf+C7wvRBQ77J87rS5k/lUZDJCRYbT8Xp/3VcImcXJVL6aaUh0R0mmkHE6i52ef8J9hNjSIA==",
505505
"dependencies": {
506-
"Microsoft.Kiota.Abstractions": "1.7.3",
506+
"Microsoft.Kiota.Abstractions": "1.7.7",
507507
"System.Diagnostics.DiagnosticSource": "[6.0.0, 9.0.0)",
508508
"System.Text.Json": "[6.0.0, 9.0.0)"
509509
}

0 commit comments

Comments
 (0)