I left the port Blank and I got connected:
Final connection string I used:
sqlsrv:Server=$ip;Database=$database;Encrypt=no;TrustServerCertificate=yes
I don't understand it why default port was the problem (and why no port at all works?) Machine (sql) as far as I know has standard configuration. Maybe somebody knows?