question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure SQL Database Deployment - Print outputs not shown, even when set to verbose

See original GitHub issue

Environment

  • Server - Azure Pipelines
  • Agent - Hosted VS2017

Issue Description

  • Task name - Azure SQL Database Deployment

Basically I want PRINT outputs from Invoke-Sqlcmd (which is used in case of “Inline SQL Script” and “SQL Script File”) to show up in the log when -Verbose is provided.

Setting system.debug to True is not a real option.

Task logs

Nothing shows up between Invoke-Sqlcmd and Finishing but many PRINT outputs should be shown:

2019-02-04T08:23:05.7040752Z ##[section]Starting: Execute pre-deployment script 2019-02-04T08:23:05.7047737Z ============================================================================== 2019-02-04T08:23:05.7047887Z Task : Azure SQL Database Deployment 2019-02-04T08:23:05.7047949Z Description : Deploy Azure SQL DB using DACPAC or run scripts using SQLCMD 2019-02-04T08:23:05.7048046Z Version : 1.2.9 2019-02-04T08:23:05.7048095Z Author : Microsoft Corporation 2019-02-04T08:23:05.7048153Z Help : More Information 2019-02-04T08:23:05.7048263Z ============================================================================== 2019-02-04T08:23:14.4480132Z Sql file: D:\a\r1\a\Foo\Database\PreDeployment.sql 2019-02-04T08:23:14.4481060Z Invoke-Sqlcmd -ServerInstance “foo.database.windows.net” -Database “Foo-Pre-Production” -Username “foo@bar” -Password ****** -Inputfile “D:\a\r1\a\Foo\Database\PreDeployment.sql” -Verbose -ConnectionTimeout 120 2019-02-04T08:23:19.2047193Z ##[section]Finishing: Execute pre-deployment script

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
timmkrausecommented, Feb 6, 2019

As I just mentioned “setting system.debug to True is not a real option”. IMHO this should only be used in debugging scenarios because it makes the whole pipeline noisy.

What I want is fine-grained control over certain tasks. In these 2 scenarios:

  1. When deploying a DACPAC I want to see the actual change script, I achieved this via /Diagnostics:True (Azure SQL Database Deployment task uses sqlpackage.exe) - This is working totally fine (without enabling system.debug), sqlpackage forwards the additional output produced by /Diagnostics:True and I am able to see (besides other stuff) the change script.

  2. When executing a script file (or an inline script) Invoke-Sqlcmd is used to achieve this task, my assumption was if I apply -Verbose to the Azure SQL Database Deployment task I am able to produce the same behavior as with sqlpackage and /Diagnostics:True which means that Invoke-Sqlcmd -Verbose logs should just be shown by the task. But this is not the case.

At a minimum this is an inconsistent behavior if not to say a bug?

We will pretty likely move into the direction of calling Invoke-Sqlcmd -Verbose directly so that there is no instance in between which swallows these logs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure SQL Database Deployment - Print outputs not ... - GitHub
Basically I want PRINT outputs from Invoke-Sqlcmd (which is used in case of "Inline SQL Script" and "SQL Script File") to show up...
Read more >
Troubleshoot pipeline runs - Azure DevOps - Microsoft Learn
Learn how to troubleshoot pipeline runs in Azure Pipelines and Team Foundation Server.
Read more >
Troubleshooting Azure SQL Edge deployments - Microsoft Learn
This article provides information about possible errors seen when deploying and using Azure SQL Edge containers, and provides ...
Read more >
Tutorial: ASP.NET app with Azure SQL Database
In this tutorial, you learn how to: Create a database in Azure SQL Database; Connect an ASP.NET app to SQL Database; Deploy the...
Read more >
Review logs to diagnose pipeline issues - Azure
To configure verbose logs for a single run, you can start a new build by choosing Run pipeline and selecting Enable system diagnostics,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found