0

I tried few steps:

  1. Connected to azure cloud using service connection ( based on service principal), SPN has contributor level access at scope subscription and rg
  2. Authenticated to Azure synapse analytics workspace using Get-AzSynapseWorkspace -Name $workspaceName
  3. Get list of sql scripts using $scripts = Get-AzSynapseSqlScript -workspaceName $workspaceName
  4. Now I am unable to find the command which can run the sql file in $scripts.

Note: Built-in SQL pool is there i.e. server less

I tried below command:

az synapse sql-script invoke --resource-group $resourceGroupName --workspace-name $workspaceName --name $scriptName --output table

I am unable to find correct command for my use-case

0

1 Answer 1

0

You can use PowerShell scripts to run scripts that are in serverless pools, invoke-sqlcmd with PowerShell. Use the command below to run the script:

$scriptfilepath = <scriptfilePath>
$Server = "<serverName>"
$database = "<dbName>"
$username = "<userName>"
$password = "<password>"
Invoke-Sqlcmd -InputFile "$(scriptfilepath)" -ServerInstance $(server) -Database $(database) -Username "$(username)" -Password "$(password)" -QueryTimeout 36000 -Verbose

For more information, you can refer to the links below:

Sign up to request clarification or add additional context in comments.

3 Comments

In my case, I have server less SQL pool. How would above suggestion work, in such case?
Can you check this once?
I checked it, but unable to create dacpac from .json version of sql script (due to azure devops repo). Could you help on that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.