无法使用使用 MS graph 创建的帐户登录 API
unable to sign in with account created using MS graph API
我使用 MS Graph API 创建了一个具有以下属性的 AZURE AD 用户(本地帐户)
AccountEnabled = true,
DisplayName = "Adele Vance",
MailNickname = "AdeleV", ,
UserPrincipalName = "abc@mydomain.onmicrosoft.com",
passwordProfile = new PasswordProfile
{
forceChangePasswordNextSignIn = true,
password = "Okkaework1"
}
passwordPolicies = "DisablePasswordExpiration"
用户(Local Account)创建成功,在用户门户的“用户”中可以看到。
但是当我第一次使用这个帐户登录时,它给了我错误:
消息是:请求中提供的用户名或密码无效。
然后我在 TrustFrameworkbase 文件中进行了更改,删除了 <Item Key="grant_type">password</Item> from <TechnicalProfile Id="login-NonInteractive">
following this
然后尝试再次登录,现在我遇到错误 “密码已过期”
我被困在这一步,因为我无法使用这个新创建的用户登录,也不知道如何才能成功登录。
任何帮助将不胜感激。
这是因为您使用的方法将创建一个工作帐户而不是个人帐户。查看工作帐户和消费者帐户之间的差异 here。
要创建本地帐户,您应该遵循以下示例:Create a user with social and local account identities, by specifying the identities/issuer
as "contoso.onmicrosoft.com" (your tenant domain). Reference here(参见发行人)。
POST https://graph.microsoft.com/v1.0/users
Content-type: application/json
{
"displayName": "John Smith",
"identities": [
{
"signInType": "userName",
"issuer": "contoso.onmicrosoft.com",
"issuerAssignedId": "johnsmith"
},
{
"signInType": "emailAddress",
"issuer": "contoso.onmicrosoft.com",
"issuerAssignedId": "jsmith@yahoo.com"
}
],
"passwordProfile" : {
"password": "password-value",
"forceChangePasswordNextSignIn": false
},
"passwordPolicies": "DisablePasswordExpiration"
}
我使用 MS Graph API 创建了一个具有以下属性的 AZURE AD 用户(本地帐户)
AccountEnabled = true,
DisplayName = "Adele Vance",
MailNickname = "AdeleV", ,
UserPrincipalName = "abc@mydomain.onmicrosoft.com",
passwordProfile = new PasswordProfile
{
forceChangePasswordNextSignIn = true,
password = "Okkaework1"
}
passwordPolicies = "DisablePasswordExpiration"
用户(Local Account)创建成功,在用户门户的“用户”中可以看到。
但是当我第一次使用这个帐户登录时,它给了我错误:
消息是:请求中提供的用户名或密码无效。
然后我在 TrustFrameworkbase 文件中进行了更改,删除了 <Item Key="grant_type">password</Item> from <TechnicalProfile Id="login-NonInteractive">
following this
然后尝试再次登录,现在我遇到错误 “密码已过期” 我被困在这一步,因为我无法使用这个新创建的用户登录,也不知道如何才能成功登录。 任何帮助将不胜感激。
这是因为您使用的方法将创建一个工作帐户而不是个人帐户。查看工作帐户和消费者帐户之间的差异 here。
要创建本地帐户,您应该遵循以下示例:Create a user with social and local account identities, by specifying the identities/issuer
as "contoso.onmicrosoft.com" (your tenant domain). Reference here(参见发行人)。
POST https://graph.microsoft.com/v1.0/users
Content-type: application/json
{
"displayName": "John Smith",
"identities": [
{
"signInType": "userName",
"issuer": "contoso.onmicrosoft.com",
"issuerAssignedId": "johnsmith"
},
{
"signInType": "emailAddress",
"issuer": "contoso.onmicrosoft.com",
"issuerAssignedId": "jsmith@yahoo.com"
}
],
"passwordProfile" : {
"password": "password-value",
"forceChangePasswordNextSignIn": false
},
"passwordPolicies": "DisablePasswordExpiration"
}