英文:
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用户卡片中(通用或电话选项卡)。
因此,我有以下问题:
- 有没有人知道如何自动从本地AD中传输数据到AAD中的相应MFA字段?无论是通过Power Automate、Powershell还是其他技术,重点是不要手动转移数据
- 如果没有机会从本地AD传输此类数据,也许有一个选项可以将创建新用户帐户视为从此字段复制他/她的号码的操作触发器:
通用选项卡上的电话号码 - 例如
到MFA此处
我会非常感激 - 对于任何建议
如果你有除了 Microsoft.Graph.Identity.Signins 之外的想法
https://learn.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-userdevicesettings
不幸的是,在这种情况下没有起作用,那将会很棒
英文:
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:
- 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
- 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
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
答案1
得分: 0
自动将用户的电话号码从 'Active Directory on-premises' 转移到 Azure Active Directory 的 MFA 字段
根据 MS DOC,直接从 On-Prem AD 同步认证联系信息到 Azure AD 是不可能的,因为这些属性是仅限云的属性。请参考 Authentication contact info。
为了更新 On-prem 用户的电话号码到 Azure AD 认证方法,你可以按照以下步骤进行。
- 使用以下 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
输出:
导出用户详细信息后,你可以使用以下 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"
}
}
输出:
运行上述代码后,电话号码 将在 Azure AD 中更新。
英文:
> 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.
-
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:
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:
Once ran the above code Phone numbers are updated in Azure AD.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论