This repository was archived by the owner on Aug 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 1010 "request" : " launch" ,
1111 "preLaunchTask" : " build" ,
1212 "program" : " ${workspaceFolder}/src/bin/Debug/net6.0/msgraph-cli.dll" ,
13- "args" : [],
13+ "args" : [" -h " ],
1414 "cwd" : " ${workspaceFolder}" ,
1515 "console" : " internalConsole" ,
1616 "stopAtEntry" : false
Original file line number Diff line number Diff line change 1- using System . CommandLine ;
1+ using ApiSdk ;
2+ using Azure . Identity ;
3+ using Microsoft . Graph . Cli . Utils ;
4+ using Microsoft . Kiota . Authentication . Azure ;
5+ using Microsoft . Kiota . Http . HttpClientLibrary ;
6+ using System . CommandLine ;
27using System . Threading . Tasks ;
38
49namespace Microsoft . Graph . Cli
510{
611 class Program {
712 static async Task < int > Main ( string [ ] args ) {
8- var rootCommand = new RootCommand ( ) ; // TODO: Replace with root command from generated client
13+ DeviceCodeCredentialOptions credOptions = new ( )
14+ {
15+ ClientId = Constants . ClientId ,
16+ TenantId = Constants . TenantId
17+ } ;
18+
19+ var credential = new DeviceCodeCredential ( credOptions ) ;
20+ var authProvider = new AzureIdentityAuthenticationProvider ( credential ) ;
21+ var core = new HttpClientRequestAdapter ( authProvider ) ;
22+ var client = new GraphClient ( core ) ;
23+
24+ var rootCommand = client . BuildCommand ( ) ;
925 rootCommand . Description = "Microsoft Graph CLI" ;
1026 return await rootCommand . InvokeAsync ( args ) ;
1127 }
Original file line number Diff line number Diff line change 99 </PropertyGroup >
1010
1111 <ItemGroup >
12+ <PackageReference Include =" Azure.Identity" Version =" 1.5.0" />
1213 <PackageReference Include =" Microsoft.Kiota.Abstractions" Version =" 1.0.25" />
14+ <PackageReference Include =" Microsoft.Kiota.Authentication.Azure" Version =" 1.0.6" />
1315 <PackageReference Include =" Microsoft.Kiota.Http.HttpClientLibrary" Version =" 1.0.16" />
1416 <PackageReference Include =" Microsoft.Kiota.Serialization.Json" Version =" 1.0.6" />
1517 <PackageReference Include =" System.CommandLine" Version =" 2.0.0-beta1.21308.1" />
Original file line number Diff line number Diff line change 1+ namespace Microsoft . Graph . Cli . Utils
2+ {
3+ class Constants
4+ {
5+ public const string AuthRecordPath = "authRecord" ;
6+
7+ public const string ClientId = "f645f5f8-2332-496d-9d85-e714b1192f0c" ;
8+
9+ public const string TenantId = "39aafea4-2975-4790-9c07-e616c1c35d99" ;
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments