This page applies to SQL Server 2012 specifically but should generally apply to all versions up to and including SQL Server 2016.
For SQL Server 2017 and above the steps may be different since the servers no longer need to be part of a Windows Failover Cluster before starting the Availability Group configuration.The following ports need to be open...
TCP 5022
Used by the database mirroring endpoint / AG endpoint. Handles data replication and synchronization between replicas. Can be changed, but must match across replicas.TCP 1433
SQL Server engine and AG listener port (unless changed). Open any custom TCP port if you have overridden the default.UDP 1434
SQL Server Browser (named instances / port resolution) (Only required if you use SQL Server Browser)TCP 135
RPC endpoint mapperTCP/UDP 3343
Cluster service / heartbeatTCP 445
SMB (file share witness, AD, etc.)UDP 137, 138 / TCP 139
NetBIOS (often still required in some environments)TCP/UDP 53
DNSTCP/UDP 88
KerberosTCP/UDP 389
LDAPTCP 5985 / 5986
WinRM (PowerShell remoting)TCP 49152–65535
(default ephemeral range)Used by RPC/DCOM and cluster operationsEnable AlwaysOn Availability Groups on all SQL Server instances to be added to the AlwaysOn Availability Group...
Repeat these steps on all SQL Servers
Restart-Service -Name MSSQLSERVER -Force
Create a new AD Group containing the Service Accounts for all database instances to be added to the AlwaysOn Availability Group...
Add the Service Account for each database instance to the new group...
Create a Login for the AD Group (created above) in all database instances to be added to the AlwaysOn Availability Group...
Note that granting sysadmin to this group may not be the most secure way of giving us what we need here. TODO: Update this page with better recommendations.Setup the Availability Group...
Assumes the Database exists on the Primary but not yet on any Replicas