Polaris – simple Microservices using only PowerShell

Tyler Leonhardt [MSFT]

Polaris – Simple Microservices using only PowerShell

Polaris is a cross-platform, minimalist web framework for PowerShell Core 6. With 6 lines of code, you have your very own webserver running and ready to accept requests – all within PowerShell:

New-GetRoute -Path "/json" -ScriptBlock {

    $json = @{ Hello = "World"; TestingTesting = @(1,2,3); }

    $response.Json(($json | ConvertTo-Json));



PS /> Invoke-RestMethod http://localhost:8080/json

Hello TestingTesting
----- --------------
World {1, 2, 3}


We open sourced this as an experiment. It’s not an officially supported Microsoft library and there is no plan yet to do so. However, we are listening to the community to determine if this work is important enough to continue investing in.

Why we made Polaris

PowerShell is evolving and we want to experiment with other use cases for PowerShell. With .NET Standard 2.0 out, we were able to get our hands on the .NET HttpListener class originally from the .NET Framework. With it comes a solution that works anywhere that PowerShell does.

We also wanted to give those that are really familiar with PowerShell a way to run their own webservers to allow for a language-agnostic way to run PowerShell scripts thanks to HTTP. Imagine a mobile app triggering remote PowerShell scripts all through HTTP. Or hosting a static site and interacting with an external API all using PowerShell for server code.

We’re excited to see all the use cases emerge and receive feedback from PowerShell’s already incredible community.


We have a few paths we are interested in taking. We hope the community helps direct us.

  • Expanding on the current implementation using HttpListener to deliver features you’d expect from projects ASP.NET or Express.js (route parameters, query parameters, middleware etc)
  • Investigating the use of Kestrel/ASP.NET Routing instead of HttpListener
  • Support for Windows PowerShell (5.x and lower)
  • Creating a routing domain-specific language (DSL) for isolating and running script blocks as routes. Drawing inspiration from Pester.

We’re open-sourcing this really early on so that we can receive feedback from you. To get started with Polaris, hop on over to the project’s GitHub. We’re excited to hear what you have to say.

Tyler Leonhardt Software Engineer PowerShell Community and Tools


Discussion is closed.

Feedback usabilla icon