Jul 17 2020 11:11 PM
Team,
I am able to query with the following Code from one Work-space but same code is not working for another Work-space but I am able to query directly after login both the workspace . I have read access where Powershell code does not returns any output. Do I need any additional permission to run the below Code ?
$query = "Heartbeat | where TimeGenerated > ago(1d) | summarize LastHeartbeat = max(TimeGenerated) by Computer | where isnotempty(Computer) | where LastHeartbeat < ago(1h)"
$selectSub = Set-AzContext -SubscriptionId "f8878fbq-4ch3-4ce0-8b08-9729ab66fa42"
if ($selectSub) {
$Workspace = Get-AzOperationalInsightsWorkspace -Name "insight-lt-workspace" -ResourceGroupName "azure-insight-lt"
try {
$Result = Invoke-AzOperationalInsightsQuery -WorkspaceId $Workspace.CustomerId.Guid -Query $query -Verbose -ErrorAction SilentlyContinue
}
catch {
Write-host 'Failure'
}
}
$Result.Results
Thanks
Biswajit