我遵循了这条指令(Using Azure GraphClient API how can you create a new Native Application?),我可以通过Azure Graph Client创建本机应用程序。但是,我不知道如何通过Graph API授予权限。
这是我的代码:
var app = new Application()
{
DisplayName = "appNativeName",
Homepage = "https://stackoverflow.com",
RequiredResourceAccess = new List<RequiredResourceAccess>()
{
new RequiredResourceAccess {
ResourceAppId = "00000002-0000-0000-c000-000000000000", //Azure AD
ResourceAccess = new List<ResourceAccess>
{
new ResourceAccess {Id = Guid.Parse("my guid id"), Type = "Scope" }
}
}
},
PublicClient = true //native app
};
await azureADContext.Applications.AddApplicationAsync(app);
var obj = app.ObjectId;
var appId = app.AppId;
我非常感谢你的帮助。