-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoke-AzOperationalInsightsQuery: -Wait
parameter is not respected when the supplied argument is larger than 100
#16553
Comments
A possible interim workaround is: $restMethod = 'Post'
$restContesntType = 'application/json'
$timeOutSec = 180
$uriTemplate = "https://api.loganalytics.io/v1/workspaces/{0}/query"
$azToken = (Get-AzAccessToken -ResourceTypeName OperationalInsights -DefaultProfile $azCtx).Token
$restUri = $uriTemplate -f $omsWs.CustomerId
[hashtable] $restHeaders = @{
Authorization = "Bearer $azToken"
Prefer = "wait=$timeOutSec"
}
[string] $restBody = @{ query = $kustoQueryString } | ConvertTo-Json
Measure-Command {
$kqlResult = Invoke-RestMethod -Method $restMethod -Uri $restUri -ContentType $restContesntType -Headers $restHeaders -Body $restBody
} But the result returned from |
Thanks @dingliu for reporting this issue, we are investigating this issue. |
Hi @dingliu Why Invoke-RestMethod Workaround @dingmeng-xue |
@LucasYao93 , 100s default value is used by all management plane cmdlets. I think we need to set wait on header if the user provides the value of |
I have fetched request use fiddler. The POST https://api.loganalytics.io/v1/workspaces/xxxxxx-xxxxxx-xxxxxxxxxx-xxxxx/query HTTP/1.1
Host: api.loganalytics.io
x-ms-client-request-id: xxxxxx-xxxxxx-xxxxxxxxxx-xxxxx
User-Agent: FxVersion/5.0.921.35908 OSName/Windows OSVersion/Microsoft.Windows.10.0.22000 Microsoft.Azure.OperationalInsights.OperationalInsightsDataClient/0.10.0.0 Az.OperationalInsights/2.3.1 PSVersion/v7.1.4 AzurePowershell/v6.4.0
prefer: response-v1=true,include-render=true,include-statistics=true,wait=180
x-ms-app: csharpsdk,LogAnalyticsPSClient
CommandName: Invoke-AzOperationalInsightsQuery
ParameterSetName: ByWorkspaceId
Content-Type: application/json; charset=utf-8
Content-Length: 27
{
"query": "union * "
} We can set a timeout for the command without affecting other parts |
Any update on this? I'm running into this issue still |
Description
-Wait
can be used to specify an upper bound on the amount of time the server will spend processing the query, as number of seconds. The details are documented here and here.However, when the supplied argument is larger than 100 and the query execution time is also longer than 100s,
Invoke-AzOperationalInsightsQuery
fails with error:Issue script & Debug output
Environment data
Module versions
Error output
The text was updated successfully, but these errors were encountered: