The PowerShell Extension is now in the Azure Data Studio Marketplace
We are excited to announce the PowerShell Extension is available in the Azure Data Studio (ADS) marketplace! Now you can write PowerShell scripts with the full benefits of PowerShell Editor Services using the excellent IDE-like interface that Azure Data Studio provides.
Key Features this Brings to PowerShell Editing in Azure Data Studio
- Syntax highlighting
- Code snippets
- IntelliSense for cmdlets and more
- Rule-based analysis provided by PowerShell Script Analyzer
- Go to Definition of cmdlets and variables
- Find References of cmdlets and variables
- Document and workspace symbol discovery
- Run selected selection of PowerShell code using F8
- Launch online help for the symbol under the cursor using Ctrl+F1
- Basic interactive console support!
How to get the PowerShell extension in Azure Data Studio
If you don’t already have Azure Data Studio, start here.
Once you have Azure Data Studio open, click
Clt+Shift+X to open the extensions marketplace.
PowerShell in the search bar.
Install on the
Reload in order to refresh Azure Data Studio.
Why we joined the Azure Data Studio Marketplace
Azure Data Studio is a powerful cross-platform database tool for data professionals using the Microsoft family of on-premises and cloud data platforms on Windows, MacOS, and Linux. Since PowerShell is a great tool for data management it just made sense to bring the full PowerShell editing experience to this marketplace.
An example for getting started with SQL PowerShell
In order to use this example (below), you need to install the SqlServer module from the PowerShell Gallery.
Install-Module SqlServer AllowPrerelease
NOTE: With version
21.1.18095-previewand up, the
SqlServermodule supports PowerShell Core 6.2 and up in addion to Windows PowerShell.
In this example we take all of the .CSV files in a directory, turn each one into a SQL Server, and insert the data.
Whether you have 7 files, like in our example, or hundreds, using PowerShell to accomplish this task can be huge time saver!
In the below example you’ll notice the PowerShell script in the green box used to navigate to the directory, turn each file into a SQL server, and insert the data. With the PowerShell extension it is easy to run your script – simply select the snippet you want to run and type F8. You’ll also notice the output in the terminal highlighted with an orange box. The arrow from this box shows the newly generated SQL tables.
As you begin to write your own scripts you’ll notice you get suggestions from the PowerShell extension, this intellisense will help you to efficently write scripts in Azure Data Studio with PowerShell. As you navigate down the suggestions you will see descriptions of what each cmdlet can do.
In the example below, typing
Write-S gives you suggestions like
Write-SQLTableData, and tells you that this cmdlet writes data to the table of a SQL database.
For more examples of how to take advantage of PowerShell for data management check out this documentation
An important benefit of being open source is getting feedback from users. To report issues with the extension use our GitHub repo. When reporting issues be sure to specify that you are using Azure Data Studio.
Sydney Smith Program Manager PowerShell Team