Powershell Azure AD V2 MFA支持

Powershell Azure AD V2 MFA支持,powershell,azure-active-directory,Powershell,Azure Active Directory,我正在寻找v2 Azure AD cmdlet的支持,特别是使用Set-AzureADUser在目录用户上分配MFA策略。那么,我如何才能为Azure AD V2 powershell启用MFA呢?我认为不可能在使用2版AAD powershell模块的用户上设置MFA。这是因为该属性似乎尚未通过AAD图形API公开 相反,您需要使用旧版本的AAD PowerShell模块(MSOL PowerShell)。网上有一些文档显示了如何做到这一点,比如 $auth=新对象-类型名Microsoft.

我正在寻找v2 Azure AD cmdlet的支持,特别是使用Set-AzureADUser在目录用户上分配MFA策略。那么,我如何才能为Azure AD V2 powershell启用MFA呢?

我认为不可能在使用2版AAD powershell模块的用户上设置MFA。这是因为该属性似乎尚未通过AAD图形API公开

相反,您需要使用旧版本的AAD PowerShell模块(MSOL PowerShell)。网上有一些文档显示了如何做到这一点,比如

$auth=新对象-类型名Microsoft.Online.Administration.StrongAuthenticationRequirement
$auth.RelyingParty=“*”
$auth.State=“已启用”
$auth.RememberDevicesNotIssuedBefore=(获取日期)
设置MsolUser-UserPrincipalName-StrongAuthenticationRequirements$auth
以这种方式设置MFA时会出现一系列警告,因为用户还需要通过MFA UI设置其MFA设置。在批量对许多用户执行此操作之前,请确保在此处测试端到端流

$auth = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$auth.RelyingParty = "*"
$auth.State = "Enabled"
$auth.RememberDevicesNotIssuedBefore = (Get-Date)
Set-MsolUser -UserPrincipalName <UserPrincipalName> -StrongAuthenticationRequirements $auth