Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

huangapple go评论67阅读模式
英文:

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

问题

在我们的组织中,我们运行一种混合环境 - 我们同时使用本地的Active Directory和Azure AD。我们希望在AAD中使用MFA功能,并在“身份验证方法”中输入员工的电话号码。

员工的电话号码已经存在于本地AD用户卡片中(通用或电话选项卡)。

因此,我有以下问题:

  1. 有没有人知道如何自动从本地AD中传输数据到AAD中的相应MFA字段?无论是通过Power Automate、Powershell还是其他技术,重点是不要手动转移数据 Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory
  2. 如果没有机会从本地AD传输此类数据,也许有一个选项可以将创建新用户帐户视为从此字段复制他/她的号码的操作触发器:

通用选项卡上的电话号码 - 例如
到MFA此处

我会非常感激 - 对于任何建议 Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

如果你有除了 Microsoft.Graph.Identity.Signins 之外的想法

https://learn.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-userdevicesettings

不幸的是,在这种情况下没有起作用,那将会很棒 Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

英文:

In my organization we're running a kind of hybrid environment - we use both Active Directory on-premises and Azure AD.
We'd like to use MFA functionality in AAD and enter employee phone numbers in 'Authentication method'
HERE
Employees phone numbers are already present on users' cards in AD on-premises (General or Telephones tab).
HERE


Therefore, I have the following questions:

  1. Does anyone know a way to automatically transfer data from AD on-premises to the appropriate MFA field in AAD? Via Power Automate, Powershell, whatever - the technology doesn't matter, the point is not to manually flip the data Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory
  2. If there is no chance to transfer such data from AD on-premises, maybe there is an option to treat creating a new user's account as a trigger to the action of copying his/her number from this field:
    Phone number on general tab - for example
    to MFA here

I'd be incredibly grateful - for any advice Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

If you have any ideas other than Microsoft.Graph.Identity.Signins

https://learn.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-userdevicesettings

which unfortunately didn't work in this case, that would be awesome Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

答案1

得分: 0

自动将用户的电话号码从 'Active Directory on-premises' 转移到 Azure Active Directory 的 MFA 字段

根据 MS DOC,直接从 On-Prem AD 同步认证联系信息到 Azure AD 是不可能的,因为这些属性是仅限云的属性。请参考 Authentication contact info

为了更新 On-prem 用户的电话号码到 Azure AD 认证方法,你可以按照以下步骤进行。

  1. 使用以下 PowerShell 代码将 On-prem AD 用户详细信息导出到 CSV 文件。
Import-Module ActiveDirectory
Get-ADUser -Filter * -Properties * | Select-Object Name, SamAccountName, EmailAddress, Description | Export-Csv -Path   C:\Users.csv -NoTypeInformation

输出:

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

导出用户详细信息后,你可以使用以下 PowerShell 代码将 认证联系信息 更新到 Azure AD

Install-Module Microsoft.Graph -Force
connect-graph -Scopes @("UserAuthenticationMethod.Read.All";"UserAuthenticationMethod.ReadWrite.All")
$inputfile = "/home/mt/EnableMFA.csv"
$data=Import-Csv -Path $inputfile
foreach ($user in $data) 
{ 
    $upn = $user.upn 
    $phone = $user.phonenumber 
    try 
    { 
        New-MgUserAuthenticationPhoneMethod -UserId $upn -PhoneNumber $phone -PhoneType "mobile" 
        Write-Host "Phone number $phone updated successfully for user $upn." 
    } 
    catch 
    { 
        Write-Host "Error updating phone number $phone for user $upn" 
    } 
}

输出:

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

运行上述代码后,电话号码 将在 Azure AD 中更新。

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

英文:

> Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

As per MS DOC it is not possible do directly sync the Authentication contact information from On-Prem AD to Azure AD, as these attributes are cloud only attributes, Follow the Authentication contact info

In order to update the On-prem users phone number to Azure AD Authentication method.you can follow below steps.

  1. Export On-prem AD user details to CSV file using below powershell code.

    Import-Module ActiveDirectory
    Get-ADUser -Filter * -Properties * | Select-Object Name, SamAccountName, EmailAddress, Description | Export-Csv -Path   C:\Users.csv -NoTypeInformation
    

Output:

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

Once export the user details, you can use below powershell code to update Authentication contact information to Azure AD.

    Install-Module Microsoft.Graph -Force
    connect-graph -Scopes @("UserAuthenticationMethod.Read.All";"UserAuthenticationMethod.ReadWrite.All")
   $inputfile = "/home/mt/EnableMFA.csv"
    $data=Import-Csv -Path $inputfile
    foreach ($user in $data) 
    { 
        $upn = $user.upn 
        $phone = $user.phonenumber 
        try 
        { 
            New-MgUserAuthenticationPhoneMethod -UserId $upn -PhoneNumber $phone -PhoneType "mobile" 
            Write-Host "Phone number $phone updated successfully for user $upn." 
        } 
        catch 
        { 
            Write-Host "Error updating phone number $phone for user $upn" 
        } 
    }

Output:

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

Once ran the above code Phone numbers are updated in Azure AD.

Automatic transfer of users' phone numbers from 'Active Directory on-premises' to MFA field in Azure Active Directory

huangapple
  • 本文由 发表于 2023年4月6日 20:41:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75949643.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定