【问题标题】:Unable to create a local account via graph api in Azure B2C无法通过 Azure B2C 中的图形 API 创建本地帐户
【发布时间】:2019-10-10 00:51:23
【问题描述】:

我正在尝试通过 Azure AD Graph API 在 B2C 域中创建“LocalAccount”。

为此,我注册了一个应用程序(通过 Azure Active Directory -> 应用程序注册(旧版))并添加了“Windows Azure Active Directory”的所有权限。

创建用户的请求是

add_user_json = {
    "accountEnabled": True,
    "creationType": "LocalAccount",
    "signInNames": [{
            "type": "emailAddress",
            "value": "test@email.com"
    },
    {
            "type": "emailAddress",
            "value": "test2@email.com"
    }],
    "displayName": user_id,
    "mailNickname": user_id,
    "passwordProfile": {
        "password": "aPassword",
        "forceChangePasswordNextLogin": "true"
    },
    "passwordPolicies": "DisablePasswordExpiration"
}

还有端点“https://graph.windows.net/{tenant}.onmicrosoft.com/users?api-version=1.6”(我也试过“https://graph.windows.net/myorganization/users?api-version=1.6”)。

我得到的错误是“一个或多个属性包含无效值。”

此外,如果我通过注册流程创建新用户,则可以创建本地帐户。

有人知道我做错了什么吗?

【问题讨论】:

    标签: azure-active-directory azure-ad-b2c


    【解决方案1】:

    “一个或多个属性包含无效值。”发生错误是因为 user 对象不能有多个相同 type 的 signInName 条目。

    【讨论】:

    • 非常感谢,删除第二个条目解决了这个问题。
    【解决方案2】:

    有一个非常好的实用程序here 可以帮助您。

    查看那里的创建示例

    一个明显的例子是:

    “forceChangePasswordNextLogin”:“真”

    这需要是“假的”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-13
      相关资源
      最近更新 更多