Azure AD Connect Health Agent fails to register with tenant

spug 51 Reputation points
2023-10-17T21:59:12.91+00:00

Hi. Pretty basic scenario. Installed Azure AD Connect (latest version) on Server 2016. All goes fine, except at end it says:

Registration failed for your Azure AD Connect Health Agent for sync

Manually re-ran Health registration with PowerShell, as per recommendations, and still ended up the same. Specific error is:

Error: This tenant is not onboarded to Microsoft Entra Connect Health. Only Tenant owners can onboard a new tenant The remote server returned an error: (400) Bad Request

Googled as much as possible, but no info at all on this specific error? Users sync to cloud fine, but nothing for the AD Health Sync Services. Have un/reinstalled AD Connect, but to no avail. Full logs says exactly the same thing:

2023-10-17 21:38:46.532 api Uri: https://management.azure.com/providers/Microsoft.ADHybridHealthService/services?serviceType=AadSyncService&api-version=2014-01-01
2023-10-17 21:38:46.609 The service is null, will make a new service and send a request to add it in database
2023-10-17 21:38:46.609 --> https://management.azure.com/providers/Microsoft.ADHybridHealthService/services?api-version=2014-01-01
TraceEntry.Start
Timestamp = 10/17/2023 21:38:46
TenantId = 00000000-0000-0000-0000-000000000000
AgentId = 
ServiceId = 00000000-0000-0000-0000-000000000000
ServiceMemberId = 00000000-0000-0000-0000-000000000000
ActivityId = 15324d45-2690-4a80-af98-c33c2a2519b2
CorrelationId = 15324d45-2690-4a80-af98-c33c2a2519b2
TraceType = Warning
CallerName = IsTransient
CallerSourceInfo = C:\__w\1\s\src\dev\common\Utils\AdHealthRetryPolicy.cs#25
Message = Operation failed. The remote server returned an error: (400) Bad Request.. Retrying...
Exception = 
TraceEventType = Registration
AgentType = NotAnAgent
ServiceType = 
Version = 3.2.01823.12
TraceEntry.End
TraceEntry.Start
Timestamp = 10/17/2023 21:38:46
TenantId = 00000000-0000-0000-0000-000000000000
AgentId = 
ServiceId = 00000000-0000-0000-0000-000000000000
ServiceMemberId = 00000000-0000-0000-0000-000000000000
ActivityId = 15324d45-2690-4a80-af98-c33c2a2519b2
CorrelationId = 15324d45-2690-4a80-af98-c33c2a2519b2
TraceType = Warning
CallerName = IsTransient
CallerSourceInfo = C:\__w\1\s\src\dev\common\Utils\AdHealthRetryPolicy.cs#25
Message = Operation failed. The remote server returned an error: (400) Bad Request.. Retrying...
Exception = 
TraceEventType = Registration
AgentType = NotAnAgent
ServiceType = 
Version = 3.2.01823.12
TraceEntry.End
TraceEntry.Start
Timestamp = 10/17/2023 21:38:57
TenantId = 00000000-0000-0000-0000-000000000000
AgentId = 
ServiceId = 00000000-0000-0000-0000-000000000000
ServiceMemberId = 00000000-0000-0000-0000-000000000000
ActivityId = 15324d45-2690-4a80-af98-c33c2a2519b2
CorrelationId = 15324d45-2690-4a80-af98-c33c2a2519b2
TraceType = Warning
CallerName = IsTransient
CallerSourceInfo = C:\__w\1\s\src\dev\common\Utils\AdHealthRetryPolicy.cs#25
Message = Operation failed. The remote server returned an error: (400) Bad Request.. Retrying...
Exception = 
TraceEventType = Registration
AgentType = NotAnAgent
ServiceType = 
Version = 3.2.01823.12
TraceEntry.End
TraceEntry.Start
Timestamp = 10/17/2023 21:39:07
TenantId = 00000000-0000-0000-0000-000000000000
AgentId = 
ServiceId = 00000000-0000-0000-0000-000000000000
ServiceMemberId = 00000000-0000-0000-0000-000000000000
ActivityId = 15324d45-2690-4a80-af98-c33c2a2519b2
CorrelationId = 15324d45-2690-4a80-af98-c33c2a2519b2
TraceType = Warning
CallerName = IsTransient
CallerSourceInfo = C:\__w\1\s\src\dev\common\Utils\AdHealthRetryPolicy.cs#25
Message = Operation failed. The remote server returned an error: (400) Bad Request.. Retrying...
Exception = 
TraceEventType = Registration
AgentType = NotAnAgent
ServiceType = 
Version = 3.2.01823.12
TraceEntry.End
2023-10-17 21:39:07.226 WebException caught: System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.Identity.Health.Common.RestRequest.<>c__DisplayClass6_0.<SendData>b__0()
   at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at Microsoft.Identity.Health.Common.RestRequest.SendData(HttpMethod httpMethod, String uri, String accessToken, String content, String contentType, X509Certificate2 clientCertificate, RemoteCertificateValidationCallback customRemoteCertificateValidation, Guid correlationId, RetryPolicy retryPolicy)
   at Microsoft.Identity.Health.Common.Clients.PowerShell.ConfigurationModule.RegisterADHealthAgent.RegisterTenantAndServiceIfNotExist(String serviceTypeName, String serviceSignature, String serviceDisplayName)
2023-10-17 21:39:07.227 Http Status Code: BadRequest
2023-10-17 21:39:07.228 Error Response: {"CorrelationId":"15324d45-2690-4a80-af98-c33c2a2519b2","Error":"This tenant is not onboarded to Microsoft Entra Connect Health. Only Tenant owners can onboard a new tenant.","Message":"Invalid request."}
ERROR: 2023-10-17 21:39:07.236 CorrelationId: 15324d45-2690-4a80-af98-c33c2a2519b2, Error: This tenant is not onboarded to Microsoft Entra Connect Health. Only Tenant owners can onboard a new tenant., Message: Invalid request.
System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.Identity.Health.Common.RestRequest.<>c__DisplayClass6_0.<SendData>b__0()
   at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at Microsoft.Identity.Health.Common.RestRequest.SendData(HttpMethod httpMethod, String uri, String accessToken, String content, String contentType, X509Certificate2 clientCertificate, RemoteCertificateValidationCallback customRemoteCertificateValidation, Guid correlationId, RetryPolicy retryPolicy)
   at Microsoft.Identity.Health.Common.Clients.PowerShell.ConfigurationModule.RegisterADHealthAgent.RegisterTenantAndServiceIfNotExist(String serviceTypeName, String serviceSignature, String serviceDisplayName)2023-10-17 21:39:07.238 The remote server returned an error: (400) Bad Request.
2023-10-17 21:39:07.24 WebException caught: System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.Identity.Health.Common.RestRequest.<>c__DisplayClass6_0.<SendData>b__0()
   at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at Microsoft.Identity.Health.Common.RestRequest.SendData(HttpMethod httpMethod, String uri, String accessToken, String content, String contentType, X509Certificate2 clientCertificate, RemoteCertificateValidationCallback customRemoteCertificateValidation, Guid correlationId, RetryPolicy retryPolicy)
   at Microsoft.Identity.Health.Common.Clients.PowerShell.ConfigurationModule.RegisterADHealthAgent.RegisterTenantAndServiceIfNotExist(String serviceTypeName, String serviceSignature, String serviceDisplayName)
   at Microsoft.Identity.Health.Common.Clients.PowerShell.ConfigurationModule.RegisterADHealthAgent.ProcessRecord()
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,692 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Andy David - MVP 142.3K Reputation points MVP
    2023-10-17T22:13:36.1966667+00:00

    Does the account you are using have a P1 or P2? and you meet the role requirements?

    https://learn.microsoft.com/en-us/azure/active-directory/hybrid/connect/how-to-connect-health-agent-install#requirements


  2. Jeff Pedlow 0 Reputation points
    2023-11-23T17:21:57.2666667+00:00

    In our case, it appeared to be an AD permissions inheritance issue.

    Once we enabled inheritance on the onprem MSOL account, we were good to go.

    As it turns out, this is very similar to: https://learn.microsoft.com/en-us/answers/questions/114601/azure-ad-sync-connect-issue-with-permission-error

    0 comments No comments