dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Invoke-DbaQuery -QueryTimeout 0 : Timeout seems to be fixed at 10 minutes no matter what we do

Open patgag opened this issue 3 years ago • 2 comments

Verified issue does not already exist?

Yes

What error did you receive?

We use Invoke-DbaQuery in Azure automation and we specify that we don't want any timeout (-QueryTimeout paremeter). The execution is raising a timeout after 10 minutes. Error message is: [21:54:47][Invoke-DbaQuery] [xxxxx.database.windows.net] Failed during execution | The wait operation timed out

Just so you know, we use SQL Azure Database Security is configured for TLS is 1.2 or greater

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

Invoke-DbaQuery -SqlInstance $global:Server -Query $SQLStatement -QueryTimeout 0

Are you running the latest release?

Yes

Other details or mentions

No response

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Azure runtime version 5.1

SQL Server Edition and Build number

Microsoft SQL Azure (RTM) - 12.0.2000.8 Feb 23 2022 11:32:53 Copyright (C) 2021 Microsoft Corporation

.NET Framework Version

We don't know

patgag avatar May 19 '22 22:05 patgag

hi @patgag , are you sure you're on a supported plan of Azure functions that can last more than 10 minutes ? The serverless one has an imposed timeout of 10 minutes, nothing to do with dbatools.

niphlod avatar May 20 '22 06:05 niphlod

Well, I'm not the technical resource in this but I know one thing for sure:

  1. We tried putting a 2 hours timeout instead of 0 (-QueryTimeout parameter) and it worked
  2. We tried rolling back to a previous version with query timeout 0 and it worked too

So, if the same environment and the same code work for a previous version and not the lastest one, it might has a breaking change. We are not using Azure function, we are using Azure Automation. (runbook written in powershell)

patgag avatar May 20 '22 19:05 patgag

Sorry that it took so long - but now I have a fix. Will open a pull request shortly.

andreasjordan avatar Oct 24 '22 14:10 andreasjordan