As a request from @amanpreetsingh-msft I made a new topic of this problem.
@amanpreetsingh-msft, here is all the information about registering health agent.
I installed Azure AD Connect v184.108.40.206 on a Win 2012 R2 machine. Choose NOT to configure the User Sign-in, because I don’t want this installation to make changes to our ADFS servers. Our ADFS servers are operational, I can’t make changes (if needed) to them now. Choose ObjectGUID as Unique identifying because old servers is also using it. All other options default installation. AAD connect is installed en configured. New sync account is created in Azure AD. One of the msg’s at the and of the installation was: Registration failed for your AAD Connect Health Agent for sync.
Did try to register it: Register-AzureADConnectHealthSyncAgent -AttributeFiltering $false -StagingMode $true. But unfortunately every time it fails.
In Azure Active Directory Connect Health I can see under sync services 2 connected servers. 1 is unhealthy. Msg:
The AAD Connect Health Service is not receiving the latest data from the server(s) listed above. This may be due to connectivity issues or data collection issues on the server itself.
If I have a look at the log files during the register process I see al lot of information. I hope I pick the right lines from this log. First error only when I use the register command.
2020-04-22 12:41:13.367 AHealthServiceUri (ARM): https://management.azure.com/providers/Microsoft.ADHybridHealthService/
2020-04-22 12:41:13.367 AdHybridHealthServiceUri: https://s1.adhybridhealth.azure.com/
ERROR: 2020-04-22 12:41:13.367 [DiscoverAndOverrideEndpoints]:Null/Empty AdalAuthority
System.InvalidOperationException: Null/Empty AdalAuthority2020-04-22 12:41:13.399 AHealthServiceUri (ARM): https://management.azure.com/providers/Microsoft.ADHybridHealthService/
2020-04-22 12:41:13.399 AdHybridHealthServiceUri: https://s1.adhybridhealth.azure.com/
During installation and registering this error did not exist:
The problem starts here I guess.
2020-04-22 09:09:54.97 Monitoring Agent Registration Attempt start
2020-04-22 09:09:54.971 Tenant Certificate successfully written to location: C:\Program Files\Microsoft Azure AD Connect Health Sync Agent\tenant.cert, byte length = 3621 bytes, written file length = 3621 bytes
2020-04-22 09:09:54.971 Start Command: C:\Program Files\Microsoft Azure AD Connect Health Sync Agent\Monitor\Microsoft.Identity.Health.AadSync.MonitoringAgent.Startup.exe sourcePath="C:\Program Files\Microsoft Azure AD Connect Health Sync Agent\tenant.cert" version="220.127.116.11"
2020-04-22 09:10:06.14 Monitoring Agent Registration Attempt process exited, ExitCode = 1
2020-04-22 09:10:06.141 Monitoring Agent Registration Attempt end, ExitCode = 1, Result = Fail
2020-04-22 09:10:06.148 Attempt Failed. Exception: System.InvalidOperationException: Failed configuring Monitoring Service using command: C:\Program Files\Microsoft Azure AD Connect Health Sync Agent\Monitor\Microsoft.Identity.Health.AadSync.MonitoringAgent.Startup.exe sourcePath="C:\Program Files\Microsoft Azure AD Connect Health Sync Agent\tenant.cert" version="18.104.22.168"
at Microsoft.Identity.Health.Common.Clients.PowerShell.ConfigurationModule.RegisterADHealthAgent.<>c_DisplayClass78_0. <StoreMonitoringServiceCertificateAndConfig>b0()
at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
This copying of the cert file and registering of the service repeats a couple of times without success. A bit futher you can read.
Agent.Main;Client activation failed:The remote server returned an error: (403) Forbidden.
System.Net.WebException: The remote server returned an error: (403) Forbidden.
And I’m running out of ideas how I must fix this.
If you need more information, I can reregister again and sent you the log.