I also received the error:
WARNING: [14:08:36][Get-DbaDatabase] Failure | The network path was not found
I use Active Directory to login.
So I changed the OP script ever so slightly:
$loginName = "email address removed for privacy reasons"
$synapseSqlName = "mysynapsesqlserverlessendpoint.database.windows.net" #had to use database.windows.net
$databaseName = "mySynDB"
$server = Connect-DbaInstance -SqlInstance $synapseSqlName -Database $databaseName -SqlCredential $loginName -DisableException
#Run a test query to confirm OK
Invoke-DbaQuery -SqlInstance $server -Query "select 1 as test"
#Then run the script just removing the login part from OP original script since I have already connected at this point
$script = Get-DbaDbTable -SqlInstance $synapseSqlName -Database $databaseName | Export-DbaScript -Passthru | Out-String
$script -replace ' NULL', '
This worked for me and the idea to use this from OP was great as it saved me a chunk of time, thanks OP!