"Unable to connect to master or target server 'XXXX'." is a generic "cannot connect to server" message. There are many reasons for this message.
First, make sure you have the latest version of SSMS, https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15
Then you need to make sure you can connect to the server from SSMS.