How to build a CI pipeline for PowerShell modules in Azure DevOps

In this post we will do a complete walkthrough for configuring a new continuous integration (CI) pipeline that builds PowerShell modules in Azure DevOps Pipelines. Formalizing your PowerShell build steps into a CI pipeline helps enforce code quality standards and setup a fully automated process for publishing.

I have covered some of these pieces individually in other posts; for example my module starter kit and linting configurations. However a full post is helpful to tie all the pieces together in a detailed guide.

Continue reading

How to add PowerShell linting to projects in Visual Studio Code

Linting tools provide a way for us to automatically analyze source code to find bugs and style problems. Adding these tools to your project will help enforce coding best practices and maintain them as the project grows. In this post we demonstrate how to configure linting for PowerShell code projects in the Visual Studio Code editor using the PSScriptAnalyzer toolset.

Continue reading

How to run PowerShell Core scripts from .NET Core applications

I wrote an MSDN blog post a few years back (here) that demonstrated how to run PowerShell scripts by hosting the PowerShell runtime inside a C# / .NET application. A few things have changed since that post; including the introduction of .NET Core and PowerShell Core, better async support, and a few new best practices.

In this article we will jump forward to take a look at runspace execution for PowerShell Core and .NET Core applications. Including topics like project setup, runspace usage examples, stream handling, shared app domain use cases, and some helpful troubleshooting tips.

Continue reading

Logging Azure Application Insights telemetry data from PowerShell

Application Insights (AI) is the application performance management (APM) and logging platform for Microsoft Azure. They provide a client instrumentation library for several popular platforms/languages– but there isn’t any official module for PowerShell. In this post I share some new functions that demonstrate how to log telemetry data to AI from PowerShell.

Continue reading