This morning I encountered an error I hadn't seen in a while, so I thought I would share the resolution with everyone (and keep a record for myself the next time it happens).
When configuring SharePoint using PowerShell after the initial install, you may encounter the error shown below.
[New-SPConfigurationDatabase: Cannot connect to database master at SQL server at ServerName. The database might not exist, or the current user does not have permission to connect to it.]
The error is misleading, as it implies that either there is no Master database on the SQL server or the current user doesn’t have the correct permissions. I did check the user’s permissions in SQL:
The required permissions, dbcreator and securityadmin, for the SharePoint installed account were configured correctly. So my next step was to confirm the SharePoint server could actually connect to the SQL server. Windows Firewall is running on the SQL server, but there wasn’t a rule allowing SQL communication (ms-sql-m).
After configuring the firewall to allow ms-sql-m traffic, the SharePoint configuration proceeded without issue.
[Windows Firewall – Allow ms-sql-m traffic (port 1433 and 1434)]