dfinke / ODataExplorer

An 'OData Explorer' PowerShell application designed to allow ad-hoc browsing of OData Services
18 stars 4 forks source link

Explore DSC Report Server OData Issue #1

Open Zuldan opened 8 years ago

Zuldan commented 8 years ago

Hi Doug, I'm trying to query a DSC Report Server using your tool but I'm not having any luck.

I'm getting Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (400) Bad Request."

https://mydscpullserver:8080/PSDSCPullServer.svc

if you want some code to quickly setup a Pull Server / Node with Report Server here is a sample https://gist.github.com/Zuldan/c679bae20de0c2dcf1aa

Any tips on how to use ODataExplorer with a DSC report server would be greatly appreciated.

On another note, it would be GREAT if you could write a blog post on how to extract reports from a DSC Report Server / OData (all nodes / per node status) and then dump the data into Excel with some fancy graphs or something ;-) It would be a great read for the whole community.

dfinke commented 8 years ago

Wow, great idea, great question, I have no idea. I will investigate. Nudge me if I don't respond in the next few days.

Thanks Doug

Zuldan commented 8 years ago

Thank you Doug! I don't know where you get the time for all of this.

So just some background info...which you probably already know.

The old reporting method, a Compliance server was used in PS4 but is now being removed (scheduled for xPSDesiredStateConfiguration v3.8.0.0 https://github.com/PowerShell/xPSDesiredStateConfiguration/pull/86). So there wouldn't be any point writing up on that.

The new method is accessing OData from a Report Server. However, in PS5, there is now 2 ways to register a node with a Pull server.

  1. Configuration ID method (it appears reporting is not currently working for this method. See https://github.com/PowerShell/xPSDesiredStateConfiguration/issues/97). To get a report for a single ndoe, you would do something like...

$requestUri = "$serviceURL/Nodes(ConfigurationId= '$ConfigurationId')/Reports"

  1. Registration Key method (which uses the AgentIDs). To get a report for a single node, you would do something like...

$requestUri = "$serviceURL/Nodes(AgentId= '$AgentId')/Reports"

I'm not sure how you would retrieve a report for 'all' nodes like you could with a Compliance server. That's what I was hoping to use ODataExplorer for.

dfinke commented 8 years ago

I wrote the OData Explorer a few years ago and haven't touched it since. Great question. This is getting into DSC details. Maybe I can loop in some folks that have more insight.

ArieHein commented 8 years ago

At the moment, no tool can allow you to query the OData. I tried a few including Dougs tool and also extracting the Odata files via powershell. Problem is MS didnt implement any Get method so no tool returns info, accept using the $requestUri and even then its limited to that structue which is a bit meh as it requires me to run the report from each node or manage AgentIDs in which case its bit silly considering the fact we removed the dependency on ConfigurationID GUIDS only to replace it with AgentID...

dfinke commented 8 years ago

Thanks for the details. I've put this on my list to pass around to some of the PS DSC folks and get their insight.