Tag: 微软图

MS Graph API C#将用户添加到组

我一直在研究如何使用Microsoft Graph API(nuget上可用的dotnet / C#库)从Azure AD组添加(以及稍后删除)用户。 Nuget MS Graph API 忽略所有其他所有关于获得连接的GraphServiceClient等。我正在尝试与下面的示例非常相似的代码,没有得到任何exception(建议事情很好)但是当我再次通过API获得该组时,它仍然没有任何成员! 有趣的是(作为旁白),当我在user对象上请求memberOf属性并告诉它扩展它时,它仍然返回null。 var user = await client.Users[userPrincipalName] .Request() .Select(“id,memberOf”) .Expand(“memberOf”) .GetAsync(); var group = await client.Groups[groupId] .Request() .Select(“members”) .Expand(“members”) .GetAsync(); group.Members.Add(user); await client.Groups[groupId].Request().UpdateAsync(group); // userPrincipalName => “test.user@mytenant.com” // groupId => the object GUID for the group 有谁知道我在这里做错了什么? 我用来提供此代码的文档基于以下文档的链接: ‘group’的API文档 将成员添加到组 此外,我尝试在此处建议的解决方案上设置方法,为用户设置许可证: 通过Graph API分配用户许可证 像往常一样,谢谢你的帮助。 彼得 […]

Microsoft Graph – 允许用户访问应用程序/服务主体

我们正在向员工推出一个主要应用程序,它已设置为使用Azure AD / SSO,我们目前必须手动设置每个用户通过Azure AD – >应用程序 – >用户访问该应用程序。 我们有一个用于管理AD用户的小型c#Web应用程序正在寻求使用新的Microsoft Graph API将用户设置为在创建时允许访问但无法找到正确的端点/ api调用。 我们尝试了以下内容,但返回的文档/错误非常缺乏。 https://graph.microsoft.com/beta/servicePrincipals https://graph.microsoft.com/beta/groups/ {id} / members 我们应该使用哪个端点/ api调用来实现此目的?