我有以下Windows PowerShell代码,它在用户创建时强制执行MFA:
$st = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$st.RelyingParty = "*"
$st.State = "Enforced"
$sta = @($st)
Set-MsolUser -UserPrincipalName $upn -StrongAuthenticationRequirements $sta | Out-Null
既然MSOnline应该被弃用,而且不是PowerShell核心的更新,那么在MSGraph(或其他模块)中是否有与此对应的代码来执行相同的操作?
1条答案
按热度按时间pexxcrt21#
有一个cmdletMap:
https://learn.microsoft.com/en-us/powershell/microsoftgraph/azuread-msoline-cmdlet-map?view=graph-powershell-1.0
SEL-msolUser被替换为UPDATE-mguser:
https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.users/update-mguser?view=graph-powershell-1.0&preserve-view=true
要安装的模块是microsoft。在图中可以看到‘mg’cmdlet,docu:
https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.bookings/?view=graph-powershell-1.0