首页 文章

Azure AD B2C密码到期

提问于
浏览
3

我们利用"sign up or sign in"政策在我们的解决方案中利用 Azure AD B2C . 定期(我没有计算确切的天数),当我尝试登录时,我得到了:"invalid username or password" . 我必须重置密码才能使其正常工作 .

所以我有两个问题:

  • Is there a default password expiration policy ? Azure B2C Connect上的功能请求之一是启用此类自定义过期策略的定义,但我没有在文档中找到默认设置到位的事实 . 有没有办法删除此默认行为(即没有过期)?

  • message "invalid username or password" is misleading 并且应该是"your password has expired" . 有什么方法可以改变吗?

谢谢 !

1 回答

  • 5

    是否有默认密码到期策略?

    对于B2C本地帐户:

    注意:只能通过注册或AAD Graph API创建本地帐户 . 您无法通过单击作为B2C租户的AAD中的新用户来创建它 .

    There is no password expiration policy for local accounts by default. Azure AD B2C 's sign-up, sign-up or sign-in and password reset policies use the 478794 password strength and don' t使Azure AD B2C中的任何密码 for local accounts 到期 . 你可以在this FAQ中看到这个 .

    但是,您可能会遇到一些B2C本地帐户用户密码过期的情况 .

    • 默认情况下,如果通过内置密码策略创建本地帐户,则此策略将 passwordPolicies 属性设置为 DisablePasswordExpiration . 所以B2C本地用户的密码不会过期 .

    • 但是,如果本地帐户由自定义策略或Azure AD Graph API创建,则必须手动将 passwordPolicies 属性设置为 DisablePasswordExpiration .

    因此,如果您的本地用户' passwords may expire after 90 days without notification if you don' t将密码策略的属性设置为 DisablePasswordExpiration .

    有没有办法删除此默认行为(即没有过期)?消息“无效的用户名或密码”具有误导性,应该是“您的密码已过期” . 有什么方法可以改变吗?

    本地帐户的解决方案:

    • 您可以通过AAD Graph API参考this example创建没有密码到期的B2C本地用户:
    POST https://graph.windows.net/contosob2c.onmicrosoft.com/users?api-version=1.6
    Authorization: Bearer eyJhbGciOiJSUzI1NiIsIng1dCI6IjdkRC1nZWNOZ1gxWmY3R0xrT3ZwT0IyZGNWQSIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJod...
    Content-Type: application/json
    Content-Length: 338
    {
    // All of these properties are required to create consumer users.
    "accountEnabled": true,
    "signInNames": [                            // controls which identifier the user uses to sign in to the account
        {
            "type": "emailAddress",             // can be 'emailAddress' or 'userName'
            "value": "joeconsumer@gmail.com"
        }
    ],
    "creationType": "LocalAccount",            // always set to 'LocalAccount'
    "displayName": "Joe Consumer",                // a value that can be used for displaying to the end user
    "mailNickname": "joec",                        // an email alias for the user
    "passwordProfile": {
        "password": "P@ssword!",
        "forceChangePasswordNextLogin": false   // always set to false
    },
    "passwordPolicies": "DisablePasswordExpiration"
    }
    
    • 通过AAD Graph API使用 PATCH 方法将受影响用户的密码策略属性更新为 DisablePasswordExpiration ,您可以参考this documentation更新您的b2c用户 .

    • 要求所有受影响的B2C用户更改其密码 .


    对于社交帐户:

    密码到期时间取决于身份提供商的密码策略 . AAD can also be an identity provider in AAD B2C .

    仅适用于 work or school accounts 的AAD密码过期策略 . 可用的密码策略设置,可应用于在Azure AD中创建和管理的用户帐户 .

    因此,如果您将AAD作为AAD B2C的社交帐户,则密码过期策略将影响这些社交帐户 .

    AAD社交账户的解决方案:

    如果您的帐户是Azure AD中的社交帐户,请使用您的公司管理员凭据连接到该租户 . 执行以下命令之一:

    • 要将一个用户的密码设置为永不过期,请使用用户主体名称(UPN)或用户的用户ID运行以下cmdlet: Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true

    • 要将组织中所有用户的密码设置为永不过期,请运行以下cmdlet: Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

    您可以在this document中查看Azure AD中有关密码策略的更多详细信息 .

相关问题