【问题标题】:Update Contact Details using Azure AD Graph & Node使用 Azure AD Graph & Node 更新联系人详细信息
【发布时间】:2018-09-21 02:50:21
【问题描述】:

我正在使用 Node.js 和 azure-graph 在 Azure 中创建用户。对于名称等基本字段,它按预期工作。但是,通常在门户中找到的 jobTitle 和其他字段无法更新。有什么指点吗?

  let msRest = require('ms-rest-azure');
  let azureGraph = require('azure-graph');

  let tenantId = common.configDefaults.azure_tenant;
  let clientId = common.configDefaults.azure_client_id;
  let clientPwd = common.configDefaults.azure_client_secret; 

  let create_user_in_azure_ad = function (user, cb) {
    msRest.loginWithServicePrincipalSecret(clientId, clientPwd, tenantId, {
      tokenAudience: 'graph'
    }, function (err, credentials, subscriptions) {
      if (err) {
        done(err.message, null);
      } else {
        // Create Azure Graph Client to access
        let client = new azureGraph(credentials, tenantId);
        let password = common.generatePassword(10);
        let userParams = {
          accountEnabled: true,
          userPrincipalName: user.email_official, //please add your domain over here
          displayName: user.display_name,
          mailNickname: user.email_official.split("@")[0],
          jobTitle: "A FANCY TITLE",
          passwordProfile: {
            password: password,
            forceChangePasswordNextLogin: true
          },
        };

        // Now, we can create the User in Active Directory
        client.users.create(userParams, function (err, done) {
          if (err) {
            cb(err, null);
          } else {
            // The user is created now with a password. Return this information
            cb(null, {user: user, password: password});
          }
        });
      }
    });
  };

【问题讨论】:

标签: node.js azure azure-active-directory azure-ad-graph-api


【解决方案1】:

虽然我不知道 Node.js,但我认为您可以通过 updating contact of a specific user 创建/更新 jobTitle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-21
    • 1970-01-01
    相关资源
    最近更新 更多