Powershell DBATools Get-DbaDbTable is giving Error

207 Views Asked by At

I am trying to get Create Table script for Azure synapse ondemand pool instance using the following script.

$connstring = ' <connection string>;Authentication="Active Directory Password";'
$server = Connect-DbaInstance -ConnectionString $connstring
Invoke-DbaQuery -SqlInstance $server -Query "select top 10 oid from dbo.orders"  ##working good
$databaseName="Sales"
Get-DbaDbTable   -SqlInstance $server -Database $databaseName -Table dbo.orders |Export-DbaScript -Passthru | Out-Host  
  


The connection uses MFA authentication and the connection is successful. but the command Get-DbaDbTable is giving the Warning as below and no output is generated

WARNING: [17:04:41][Invoke-QueryRawDatabases] Failure | You cannot call a method on a null-valued expression.

Can experts help me on this..

1

There are 1 best solutions below

0
On

Change connection string to server from *-ondemand.sql.azuresynapse.net to *-ondemand.database.windows.net.