The cause of the issue depends on the validation error. For more information about a specific error, run the appropriate Windows PowerShell cmdlet based on the object type in the Azure Active Directory Module for Windows PowerShell.
For contacts
The following cmdlet retrieves all the errors on the object:
$errors = (Get-MsolContact –ObjectID <Object_ID>).Errors
The following cmdlet iterates through each error and retrieves the service information and error message:
$errors | foreach-object {"`nService: " + $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
For example, run the following cmdlets:
$errors = (Get-MsolContact –ObjectID 430ecced-b2c5-455b-94df-ab2b5756b060 ).Errors
$errors | foreach-object {"`nService: "+ $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
For groups
The following cmdlet retrieves all the errors on the object:
$errors = (Get-MsolGroup –ObjectID <Object_ID>).Errors
The following cmdlet iterates through each error and retrieves the service information and error message:
$errors | foreach-object {"`nService: " + $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
For example, run the following cmdlets:
$errors = (Get-MsolGroup –ObjectID 430ecced-b2c5-455b-94df-ab2b5756b060 ).Errors
$errors | foreach-object {"`nService: "+ $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
For users
The following cmdlet retrieves all the errors on the object of interest:
$errors = (Get-MsolUser -UserPrincipalName "<User_ID>").Errors
The following cmdlet retrieves all the errors for all users on Azure AD:
Get-MsolUser -HasErrorsOnly -All | ft DisplayName,UserPrincipalName,@{Name="Error";Expression={($_.errors[0].ErrorDetail.objecterrors.errorrecord.ErrorDescription)}} -AutoSize -wrap
To obtain the errors in CSV format, use the following cmdlet:
Get-MsolUser -HasErrorsOnly | select DisplayName,UserPrincipalName,@{Name="Error";Expression={($_.errors[0].ErrorDetail.objecterrors.errorrecord.ErrorDescription)}} | Export-csv c:\temp\validationerrors.csv
The following cmdlet iterates through each error and retrieves the service information and error message:
$errors | foreach-object {"`nService: " + $_.ErrorDetail.Name.split("/")[0]; "Error Message: " + $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
For example, run the following cmdlets:
$errors = (get-msoluser -userprincipalname "johnsmith@contoso.com").Errors
Get-MsolUser -HasErrorsOnly -All | ft DisplayName,UserPrincipalName,@{Name="Error";Expression={($_.errors[0].ErrorDetail.objecterrors.errorrecord.ErrorDescription)}} -AutoSize -wrap
Get-MsolUser -HasErrorsOnly | select DisplayName,UserPrincipalName,@{Name="Error";Expression={($_.errors[0].ErrorDetail.objecterrors.errorrecord.ErrorDescription)}} | Export-csv c:\temp\validationerrors.csv
$errors | foreach-object {"`nService: "+ $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
The output will resemble the following:
Service: MicrosoftCommunicationsOnline
Error Message: The value of the msRTCSIP-LineURI field in your local Active Directory is not unique, or the WorkPhone filed for the user conflicts with other users. Correct the value in your local Active Directory or in the tenant admin UI. After you correct it, the value will be updated in your Microsoft Online Services directory during the next Active Directory synchronization.