Tag: azure ad graph api

使用http post请求,使用Graph API在Azure Active Directory(B2C)中创建新用户

我以前使用Active Directory身份validation库(ADAL)以编程方式添加用户,但现在我需要定义“signInNames”(=用户电子邮件),这似乎不可能与ADAL(请告诉我,如果我错了) 。 现在,我正在尝试使用HTTP POST以编程方式添加新用户(本地帐户),遵循MSDN上的文档 。 //Get access token (using ADAL) var authenticationContext = new AuthenticationContext(AuthString, false); var clientCred = new ClientCredential(ClientId, ClientSecret); var authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, clientCred); var token = authenticationResult.Result.AccessToken; //HTTP POST CODE const string mail = “new@email.com”; // Create a new user object. var user = new CustomUser { accountEnabled = true, […]

调用AddUserAsync .NET Core 2.0时出现PlatformNotSupportedexception

我正在尝试编写一些使用Graph API在Azure AD中创建用户的代码。 我开始用网上的一个例子,但现在它在添加用户时就失败了 await adClient.Users.AddUserAsync(userGraphObj); 在下面的CreateUser()方法中。 我得到的错误是 我正在使用.NET Core 2.0,在Windows 7上进行调试。谷歌搜索并发现它们为2.0提供了序列化, 但仅针对特定类型 。 我真的不在乎。 如何在代码中将用户添加到Azure AD? const String appClientID = “2be733f1-88c3-6482-8e2a-5e9631fc3a32”; const String tenant = “brazzers.onmicrosoft.com”; const String authString = “https://login.microsoftonline.com/” + tenant; const String authClientSecret = “dDdaVGee315s65ewDSWEwfdw7wq5efDNO5C3cvN4RA”; const String resAzureGraphAPI = “https://graph.windows.net”; const String serviceRootURL = resAzureGraphAPI + appClientID; private ActiveDirectoryClient GetAADClient() { […]

使用Microsoft Graph更改Azure AD的密码

我计划使用Azure AD Graph API,但随后在Microsoft文档中注意到有关使用Microsoft Graph API的建议。 是否提供了更改用户密码的文档? string result = Task.Run(async() => { return await GetAccessToken(); }).GetAwaiter().GetResult(); var graphserviceClient = new GraphServiceClient( new DelegateAuthenticationProvider( (requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue(“bearer”, result); return Task.FromResult(0); })); var changePasswordRequest = graphserviceClient.Me.ChangePassword(“oldpassword”, “newpassword”); 但是我认为这还不够。 有可用的文件吗?

使用图API API在Azure Active Directory中创建应用程序失败

我正在尝试使用Azure Active Directory图谱API(使用Azure GraphClient nuget包)在Azure AD中创建新应用程序。 我使用现有的AAD应用程序进行了身份validation,因此我对该目录具有写入权限。 但是,在创建新的应用程序对象时,Azure Graph API会返回以下错误: {“odata.error”: { “code”:”Request_BadRequest”, “message”: { “lang”:”en”, “value”:”Property value cannot have duplicate id or claim values.” }, “values”: [{ “item”:”PropertyName”, “value”:”None” }, { “item”:”PropertyErrorCode”, “value”:”DuplicateValue” } ] } } 它没有说明哪个属性具有重复的id或声明值 – 错误消息中有两个空格,就好像名称缺失一样。 创建Application对象的代码是这样的: var appname = “Test Application create ” + DateTime.Now.Ticks; var application = new […]

无法从Azure AD获取承载令牌以与API App一起使用

我有一个MVC应用程序需要访问Azure中受Azure AD身份validation保护的私有API应用程序。 因此,我需要获取Azure AD持有者令牌,将其转移到Zumo-Auth令牌并使用它来访问API应用程序。 我正在阅读本教程 ,一切正常,直到我需要从authContext请求令牌。 这是代码的片段: var authContext = new AuthenticationContext( “https://login.microsoftonline.com/MyADDomain.onmicrosoft.com”); ClientCredential credential = new ClientCredential( “04472E33-2638-FAKE-GUID-F826AF4928DB”, “OMYAPIKEY1x3BLAHEMMEHEHEHEHEeYSOMETHINGRc=”); // Get the AAD token. var appIdUri = “https://MyAppGateway-814485545465FAKE4d5a4532cd.azurewebsites.net/login/aad”; //var appIdUri = “https://MyADDomain.onmicrosoft.com/MyAppName”; //var appIdUri = “https://MyADDomain.onmicrosoft.com/”; //var appIdUri = “https://graph.windows.net”; AuthenticationResult result = authContext.AcquireToken(appIdUri, credential); // <– can't get the token from AD // […]

如何使用Microsoft Graph API显示当前可用会议室列表

我一直在尝试使用Microsoft Graph API。 我有一个情况。 我已经为一些会议室分配了一个电子邮件ID,并希望了解所有会议室的可用性。 如果房间目前可用,我应该得到会议室的名称,如果可能的话,我会得到房间的可用时间。 我想知道如何查询多个房间并返回数据。 对以下API有点困惑,这些有用吗? https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/user_findmeetingtimes GET https://graph.microsoft.com/beta/me/calendar