Andreas Jordan
Andreas Jordan
This is basically the code we run inside of Connect-DbaInstance: ``` $serverName = 'sql01\sql2022' $EncryptConnection = Get-DbatoolsConfigValue -FullName 'sql.connection.encrypt' $TrustServerCertificate = Get-DbatoolsConfigValue -FullName 'sql.connection.trustcert' $sqlConnectionInfo = New-Object -TypeName Microsoft.SqlServer.Management.Common.SqlConnectionInfo -ArgumentList...
Can you run the Write- command with -Verbose and provide the output?
Ok, I hoped for more output. I will have a look at the code in the next days and try to provide a workaround or a fix.
Looking at the code I would expect more verbose output. You are using a pooled connection, so inside of Write-DbaDbTableData, Connect-DbaInstece is called and that command has also verbose output....
I'll try to setup my azure lab to be able to use a token - will probably take some days. Most probably it has something to do with the way...
OK, I can reproduce the error. The line `$databaseObject.Tables.Refresh()` throws the error. It looks like the "Database" part of the SMO is not filled at all (only "Name" is set)....
The problem is not inside of `Write-DbaDbDatatable` but inside of `Connect-DbaInstance` when using `-AccessToken`. If I connect to the same Azure SQL Database with username and password, it works perfectly....
For more information about AccessToken see this issue from 2019: #5445 As we only use the SMO inside of `Write-DbaDbDatatable` to test if the table (and the schema) exists, I...
My PR has some side effects - other tests fail now. I have to do more tests. Will do this in the next days...
I now have a working version of the pull request. Waiting for the review and merge...