What causes SQL error 41106? I get an error when I try to join the secondary replica to the Availability group thru Powershell while following the below Microsoft Documentation.

Join-SqlAvailabilityGroup -Path "SQLSERVER:\SQL\&lt;SecondaryComputer&gt;\Instance" -Name "&lt;AG Name&gt;"

Error:


  Failed to join local availability replica to availability group ''.  The operation encountered SQL Server error 41106 and has been
  rolled back.  Check the SQL Server error log for more details.  When
  the cause of the error has been resolved, retry the ALTER AVAILABILITY
  GROUP JOIN command.


https://docs.microsoft.com/en-us/sql/database-engine/availability-groups/windows/create-an-availability-group-sql-server-powershell?view=sql-server-2017#ExampleConfigureGroup

I tried the T-SQL command thru SSMS as well. 

USE MASTER
ALTER AVAILABILITY GROUP &lt;AG Name&gt; JOIN;


Same error.
The default database for my login was set to 'TempDB'. Changed that to 'Master'. And there was a DNS registration issue with the first node. So the secondary replica wasn't able to communicate with the primary by computername. Correcting these two resolved the issue. 

Join-SqlAvailabilityGroup worked properly.