PowerShell Notebooks in Azure Data Studio

The latest release of the insiders edition of Azure Data Studio brings the first edition of PowerShell Notebooks!

You can download the latest insiders edition from the link above, it can be installed alongside the stable release.

To access many of the commands available use F1 to open the command palette (like many of my tips this also works in Visual Studio Code). You can then start typing to get the command that you want.

You can then hit enter with the command that you want highlighted, use the mouse or use the shortcut which is displayed to the right.

In a new notebook, you can click the drop down next to kernel and now you can see that PowerShell is available

When you choose the PowerShell kernel, you will get a prompt asking you to configure the Python installation

If you have Python already installed you can browse to the location that it is installed or you can install Python. In the bottom pane you will be able to see the progress of the installation.

When it has completed, you will see

You may also get a prompt asking if you would like to upgrade some packages

Again this will be displayed in the tasks pane

Adding PowerShell

To add PowerShell Code to the notebook click the Code button at the top of the file

or the one you can find by highlighting above or below a block

I did not have intellisense, but you can easily write your code in Azure Data Studio or Visual Studio Code and paste it in the block.

Interestingly Shawn Melton ( t ) did

This was because he had the PowerShell extension installed and I did not (I know !!)
If you find you dont have intellisense then install the PowerShell extension!

Clicking the play button (which is only visible when you hover the mouse over it) will run the code

You can clear the results from every code block using the clear results button at the top

Otherwise, you can save the results with the Notebook by saving it. This is the part that is missing from running PowerShell in the Markdown blocks in a SQL Notebook as I described here

I am looking forward to how this develops. You can find my sample PowerShell notebook (with the code results) here

7 thoughts on “PowerShell Notebooks in Azure Data Studio

  1. Thank you so very much for this article. This is really cool.I tried the same and I already have python installed, and it didn’t ask me to configure it but did ask if I wanted to upgrade some packages. It failed out with message “Installing pandas>=0.24.2 sparkmagic>=0.12.9 powershell-kernel>=0.1.0 sqlmlutils>=0.7.1: Process exited with code 1”. What I might be doing wrong?

  2. I can see this being very useful. 10 minutes after installing the latest build and I have a git cheat sheet type document forming with common command sequences (e.g. checkout and refresh master\uat branches).

  3. Pingback: New .NET Notebooks are here – PowerShell 7 notebooks are here. | SQL DBA with A Beard

Leave a Reply to Barney LawrenceCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.