Powershell and Rest API
15 TopicsSearching Azure Log Analytics Using the New Search LanguageREST API in PowerShell
I have published a PowerShell script for searching your Azure Log Analytics workspace using the new search API (https://dev.int.loganalytics.io). To read the full article: https://blog.tyang.org/2017/11/14/searching-oms-using-the-new-search-language-kusto-rest-api-in-powershell/1.4KViews3likes1CommentPermissions to query Azure Log Analytics from PowerShell
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 Biswajit1.8KViews1like0Comments