Comments (13)
Can you run the Write- command with -Verbose and provide the output?
from dbatools.
VERBOSE: [17:57:03][Write-DbaDbTableData] FQTN processed: [dbo].[redactedTable]
from dbatools.
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.
from dbatools.
Thank you!
from dbatools.
As my workaround I converted my functions to use invoke-dbaquery. It works, but it's messier than I'd like it to be when I have tables with lots of columns.
from dbatools.
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. Do you really only get this one line?
The problem in your case might be, that inside of Write-DbaDbTableData a new connection is opened and not the connection from $server is reused.
It might help to open the connection as non-pooled ($server = Connect-DbaInstance -SqlInstance $azureInstance -Database $azureDatabase -AccessToken $azureToken -NonPooledConnection
) because then there is a different code path used inside of Write-DbaDbTableData.
from dbatools.
I tried creating the $server object as both pooled and non-pooled with the same result. I also used -verbose and -debug and received the same output.
VERBOSE: [14:56:20][Write-DbaDbTableData] FQTN processed: [dbo].[redactedTable]
DEBUG: 88670 | [14:56:20][Write-DbaDbTableData] FQTN processed: [dbo].[redactedTable]
DEBUG: [14:56:20][Write-DbaDbTableData] Failure | Login failed for user ''.
from dbatools.
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 we create the server SMO when using a token. @potatoqualitee do you have a lab where can test that?
from dbatools.
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). Will do more investigations...
from dbatools.
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.
To test, run $server.Databases.Tables.Count
. It should return the number of tables in the database, but returns nothing if the connection is made with access token.
from dbatools.
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 changed this to just test the table by running a select against it.
Will open a PR soon.
from dbatools.
My PR has some side effects - other tests fail now. I have to do more tests. Will do this in the next days...
from dbatools.
I now have a working version of the pull request. Waiting for the review and merge...
from dbatools.
Related Issues (20)
- Copy-DbaAgentJob fails when trying to copy CDC jobs HOT 3
- New-DbaAgentJobStep -DatabaseUser is not setting the username for the job. HOT 2
- PowerShell 7.4.2 version error with dotnet 8.0.4 and Microsoft.Data.SqlClient assembly HOT 1
- Warning after run Get-Dbatoolsconfig or Find-DbaInstance on Windows Server 2016 HOT 2
- Restore-DbaDatabase with -Continue when Database has Memory Optimized File Group and/or multiple differential_base_lsn HOT 1
- Behavior of `Get-DbaDatabase -Database DoesNotExist` HOT 2
- New-DbaAgentSchedule flags an error with a start time before 10000? HOT 4
- Install-DbaFirstResponderKit is installing version 8.18, which is old HOT 4
- Publish-DbaDacPackage appears to ignore DacFxPath option HOT 1
- Harmonize the description of the parameter SqlInstance
- Get-DbaRegisteredServer - -ExcludeServer would be usefull
- New-DbaAgentSchedule's documentation does not illustrate most of its parameters
- Copy-DbaLogin does not update the password if it was changed HOT 7
- New-DbaConnectionString Multiple Errors/Issues HOT 9
- None of the commands are working HOT 4
- Get-DbaDbStoredProcedure seems to hang after first database HOT 17
- Get-DbaService Timeout seemed to be around 5 min no matter what settings related to connection in DbatoolsConfig
- The value's length for key 'data source' exceeds it's limit of '128'
- Write-DbaDbTableData does not handle Measure-DbaDbVirtualLogFile output when there are multiple log files for a database HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbatools.