Skip to content
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-AzureRmOperationalInsightsQuery returns any data as string #6032

Open
slavizh opened this issue Apr 24, 2018 · 5 comments
Open

Invoke-AzureRmOperationalInsightsQuery returns any data as string #6032

slavizh opened this issue Apr 24, 2018 · 5 comments
Assignees
Labels
Monitor - Operational Insights Service Attention This issue is responsible by Azure service team.

Comments

@slavizh
Copy link

slavizh commented Apr 24, 2018

Description

When run Invoke-AzureRmOperationalInsightsQuery and get .Results from the object all data is returned as string. According to the official documentation the Log Analytics Search API returns the types of the different columns. The Enumerable that is returned for results should honer the data types and return them as the output of the query rather returning every column as string. This breaks any functionality to
handle the data properly like converting it to JSON or PowerShell array and make some actions by doing comparison on things like dates, integers, etc.

Script/Steps for Reproduction

Works with any query that return results with different formats like int.

$summaryQuery = 'Perf | take 1'
$summaryQueryResults =Invoke-AzureRmOperationalInsightsQuery -Workspace $Workspace -Query $Query -Timespan (New-TimeSpan -Hours 24)
$summaryQueryResults.Results.CounterValue
0
$summaryQueryResults.Results.CounterValue.GetType()
IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     String                                   System.Object

It should've integer or double but not string.

Module Version

Get-Module -Name AzureRM -ListAvailable
    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.4.1      AzureRM

Environment Data

$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17134.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Debug Output

There is no need for debug as it can be reproduced very easily.


@alexeldeib
Copy link
Contributor

@slavizh appreciate you giving feedback on this -- definitely makes sense. I'm taking a look at modifying the cmdlet to return the values as their proper data types.

@slavizh
Copy link
Author

slavizh commented Apr 27, 2018

Thanks @alexeldeib . I am currently using workoaround by querying the API with my own function but as soon as the data is returned according to the LA schema I will switch back to the cmdlet.

@slavizh
Copy link
Author

slavizh commented Dec 7, 2019

It has been year and so and in Az 3.1 this bug is still present.

@jethrovaneetvelde
Copy link

So, is this ever getting fixed?

@ghost
Copy link

ghost commented May 7, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzmonLogA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor - Operational Insights Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants