[英]Is there any way to check password hash sync status in Java code?
I'm working with azure SDK and I need to check the status of "password hash sync" in code.我正在使用 azure SDK ,我需要检查代码中“密码 hash 同步”的状态。 Is there any way to check in Java?
有什么办法可以查到 Java 吗?
below are some document I researched:以下是我研究的一些文件:
https://github.com/Azure/azure-sdk-for-java https://github.com/Azure/azure-sdk-for-java
https://docs.microsoft.com/en-us/azure/active-directory/hybrid/tutorial-password-hash-sync https://docs.microsoft.com/en-us/azure/active-directory/hybrid/tutorial-password-hash-sync
https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-password-hash-synchronization https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-password-hash-synchronization
I'm afraid there's no SDK to get the status of password hash sync.恐怕没有 SDK 来获取密码 hash 同步的状态。 Only
Get-ADSyncAADCompanyFeature
can help you.只有
Get-ADSyncAADCompanyFeature
可以帮助您。
You could try to create a powershell script and then invoke the powershell script from java .您可以尝试创建 powershell 脚本,然后从 java 调用 powershell 脚本。
Import-Module ADSync
$connectors = Get-ADSyncConnector
$aadConnectors = $connectors | Where-Object {$_.SubType -eq "Windows Azure Active Directory (Microsoft)"}
$adConnectors = $connectors | Where-Object {$_.ConnectorTypeName -eq "AD"}
if ($aadConnectors -ne $null -and $adConnectors -ne $null)
{
if ($aadConnectors.Count -eq 1)
{
$features = Get-ADSyncAADCompanyFeature
Write-Host
Write-Host "Password sync feature enabled in your Azure AD directory: " $features.PasswordHashSync
foreach ($adConnector in $adConnectors)
{
Write-Host
Write-Host "Password sync channel status BEGIN ------------------------------------------------------- "
Write-Host
Get-ADSyncAADPasswordSyncConfiguration -SourceConnector $adConnector.Name
Write-Host
$pingEvents =
Get-EventLog -LogName "Application" -Source "Directory Synchronization" -InstanceId 654 -After (Get-Date).AddHours(-3) |
Where-Object { $_.Message.ToUpperInvariant().Contains($adConnector.Identifier.ToString("D").ToUpperInvariant()) } |
Sort-Object { $_.Time } -Descending
if ($pingEvents -ne $null)
{
Write-Host "Latest heart beat event (within last 3 hours). Time " $pingEvents[0].TimeWritten
}
else
{
Write-Warning "No ping event found within last 3 hours."
}
Write-Host
Write-Host "Password sync channel status END ------------------------------------------------------- "
Write-Host
}
}
else
{
Write-Warning "More than one Azure AD Connectors found. Please update the script to use the appropriate Connector."
}
}
Write-Host
if ($aadConnectors -eq $null)
{
Write-Warning "No Azure AD Connector was found."
}
if ($adConnectors -eq $null)
{
Write-Warning "No AD DS Connector was found."
}
Write-Host
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.