简体   繁体   English

将 Msol Powershell 转换为 Azure Powershell

[英]Convert Msol Powershell to Azure Powershell

I need some help with Azure powershell as i know very little about powershell,Any help would be much appreciated.我需要一些有关 Azure powershell 的帮助,因为我对 powershell 知之甚少,任何帮助将不胜感激。 (this will be used in Azure Runbook check for people who register for MFA and add them to a group for conditional access) (这将用于 Azure Runbook 检查注册 MFA 并将他们添加到组以进行条件访问的人员)

I would like to convert this Msol Powershell script to Azure powershell我想将此 Msol Powershell 脚本转换为 Azure powershell

#get group
$group = get-msolgroup - <groupIDnumber>

#get all users with stronge authentication 
$users = get-msoluser -all | select userprincipalname,objectid,StrongAuthenticationMethods
  | where {$_.StrongAuthenticationMethods -ne $null}

#add users to group
$users | foreach {
    add-msolgroupmember -groupobjectid $group.objectid -groupmembertype "user" -groupmemberobjectid $_.objectid
}

So far i have到目前为止我有

$group = get-AzureADgroup -objectid <groupidnumber>

Check the commands in the latest AzureAD module.检查最新 AzureAD 模块中的命令。

https://docs.microsoft.com/en-us/powershell/module/azuread/ https://docs.microsoft.com/en-us/powershell/module/azuread/

I believe the cmdlet structure are the same you just need to change msol with AzureAD我相信 cmdlet 结构是一样的,你只需要用msol改变AzureAD

From what I see, there's no way to get the StrongAuthenticationMethods property (or its equivalent) with the AzureAD cmdlets.据我所知,无法使用 AzureAD cmdlet 获取 StrongAuthenticationMethods 属性(或其等效项)。 There's a long standing request to add this: https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/20249953-powershell-and-graph-api-support-for-managing-mult?page=1&per_page=20长期以来一直要求添加此内容: https : //feedback.azure.com/forums/169401-azure-active-directory/suggestions/20249953-powershell-and-graph-api-support-for-managing-mult?page =1&每页=20

You can get a user's authentication methods from the Microsoft Graph API at https://graph.microsoft.com/beta/users/{id}/authentication/methods .您可以从 Microsoft Graph API 获取用户的身份验证方法, 网址https://graph.microsoft.com/beta/users/{id}/authentication/methods See https://docs.microsoft.com/en-us/graph/api/resources/authenticationmethod?view=graph-rest-beta请参阅https://docs.microsoft.com/en-us/graph/api/resources/authenticationmethod?view=graph-rest-beta

But if really you just want to add these users to a conditional access group, can you just create a conditional access policy instead?但是,如果您真的只想将这些用户添加到条件访问组中,是否可以只创建条件访问策略? See https://docs.microsoft.com/en-us/azure/active-directory/authentication/tutorial-enable-azure-mfa请参阅https://docs.microsoft.com/en-us/azure/active-directory/authentication/tutorial-enable-azure-mfa

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM