Make Some Noise for the New FlashArray PowerShell SDK Version 2.16

The Pure Storage FlashArray PowerShell SDK 2.16 has been released. This article shows how easy it is to install and includes some examples and additional resources.

flashArray PowerShell SDK

image_pdfimage_print

I am immensely proud to announce that the Pure Storage® FlashArray™ PowerShell SDK 2.16 has been released! The latest version of the FlashArray PowerShell SDK has been a long time in the making, but where did it all start? It was 2015 in a dimly lit room in our Mountain View office when I implemented the PowerShell Toolkit as an SSH pass-through sending CLI commands. Once we introduced the REST API, the real fun started. Seeing the Toolkit evolve into the SDK has been incredibly fun and rewarding. 

I’ve overseen our PowerShell development for the last seven years and the new SDK 2.16 is exciting for me because we have parity with the latest version of Purity. Being on parity has been a long-time goal for the team and one of the most notable features. 

Parity was a goal for the team, but even more importantly, it was for you, the customer. With the release of SDK 2.16, we paid close attention to our customers, partners, and internal feedback. Yep, we listened to all of it and focused on the things that mattered to you.

Some feedback examples:

  • When are you going to be on parity with Purity REST APIs?
  • Why do I need to use that confusing New-Pfa2ReferenceObject cmdlet?
  • Can you add consistently updated online help with practical examples?
  • What is the cmdlet equivalent for this REST endpoint?

These are just a few examples, but they bubbled up as the most important to the users. So how did we answer these questions?

Answers:

  • We are now on parity with Purity 6.3.4 which supports REST API 2.16. 
  • No more confusing Reference Object! We have simplified the cmdlets that previously required it. 
  • We’ve added updated online help with better examples and details.
  • We created a new catch-all cmdlet, Invoke-Pfa2RestCommand.

With the REST API 2.16, there were many new features and we have added over 150 cmdlets to cover them. Check out the list of new cmdlets in the Microsoft Platform Guide.

Let’s take a quick look at how easy it is to install, followed by some examples and additional resources.

Installation Simplicity

With .NET Core, we support multiple operating system platforms that can run PowerShell, including Windows client, Windows Server, macOS, and Linux. Be sure to check the Microsoft Support Matrix for details on specific operating system support. 

Like previous versions, the SDK comes as either an installable and updateable module from the PowerShell Gallery (PSGallery) for Windows, macOS, and Linux operating systems, or as a downloadable standalone MSI installer for Windows client and Server. 

As a best practice, we recommend installation from the PSGallery to ensure you get the latest revisions available via the Update-Module cmdlet. It should also be noted that you can run both version 1.x and version 2.x SDKs side by side on your Windows computer.

Installing the module from the PSGallery is as easy as running the Install-Module cmdlet and Import-Module cmdlet shown here:

You can install from the PSGallery for Windows, macOS, and Linux. An important note when installing from the PSGallery is regarding Untrusted vs. Trusted repositories. You may see this message when using the Install-Module cmdlet:

Check this article for details on what this means and how to set the PSGallery as a Trusted repository.                                                                                                        

MSI Installation (Windows Only)

Installing using the MSI package is only available for Windows operating systems. First, download the MSI installer and run the Windows Installer Package, PureStoragePowerShellSDK2Installer.msi.

powershell

Does It Work?

To check if the installation was successfully completed, open a PowerShell session and type:

power

Now you can list the cmdlets that are part of the SDK 2.16:

powershell

You can run both the SDK v1.x and SDK 2.16 modules together on the same machine, allowing for full version compatibility. 

powershell

Once we have verified the module is loaded, let’s take the SDK for a test drive.

Modern Hybrid Cloud Solutions

Getting Started with the SDK

In PowerShell, everything can be considered a workflow because cmdlets are performing actions which feed objects to the next cmdlet and so on. Let’s look at a basic workflow that you would use with the FlashArray:

Steps

  1. Connect to a FlashArray
  2. Create a Host
  3. Create a Volume
  4. Connect a Volume to a Host
  5. Create a Volume Snapshot

Step 1: Connect to a FlashArray

In the example below the authentication method, I am using the parameter -Credential which will pop up a standard login dialog with Get-Credential. You can also connect using OAuth2

My demo FlashArray does not have a certificate, so I specify the parameter -IgnoreCertificateError to bypass the certificate requirement.

Once connected, I query the $FlashArray variable and can see the ApiVersion of 2.16.

power

Step 2: Create a Host

When creating a host, you can specify WWNs, IQNs, or NQNs. I am using WWNs for Fibre Channel and passing it in as a variable.

powershell

Step 3: Create a Volume

power

Step 4: Connect a Volume to a Host

powershell

Step 5: Create a Volume Snapshot

power

Now, this might be a basic workflow but apply it to a real-world use case such as database refreshes. The only code this workflow is missing are the cmdlets to rescan for the new volume(s) or snapshot, online the volume(s), and connect the SQL Server database to an instance.

Whatever your storage or application workflow might be, I’m pretty sure the SDK and FlashArray can do it. Hmmm…that might be taken as a challenge 🙂 Let the games begin! 

What’s Next?

We are always innovating across our portfolio of products and all of them are focused on an API-first approach. We all know that automation and orchestration is here to stay, and it is our intention to add more capabilities to our core products and extend those in SDKs, application integrations, and more.

Resources

Here is a list of resources that can help get you started with the SDK.

The team looks forward to talking with you and we are listening!

Cheers – Barkz

This blog post was previously published on purepowershellguy.com.

Written By: