I am immensely proud to announce that the FlashArray PowerShell SDK 2.16 has been released! The latest version of the 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 that 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 7 years and the new SDK 2.16 is exciting for me because we have parity with the latest version Purity. Being on parity has been a long-time goal of the team and one of the most notable features.
Parity was a goal of the team, even more importantly was 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 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?
- 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?
- We are now on parity with Purity 6.3.4 which supports REST API 2.16.
- Not any longer! We have simplified the cmdlets that required the Reference Object previously.
- Updated and online 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.
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.
PowerShell Gallery Installation
Installing the module from the PSGallery is as easy as running the Install-Module cmdlet and Import-Module cmdlet shown here:
Install-Module -Name PureStoragePowerShellSDK2 Import-Module -Name PureStoragePowerShellSDK2
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:
Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
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.
Does it Work?
To check if the installation was successfully completed, open a PowerShell session and type:
Get-Module -Name PureStoragePowerShellSDK2
Now you can list the cmdlets that are part of the SDK 2.16:
Get-Command -Module PureStoragePowerShellSDK2
You can run both the SDK v1.x and SDK 2.16 modules together on the same machine, allowing for full version compatibility.
Once we have verified the module is loaded, let’s take the SDK for a test drive.
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:
- Connect to a FlashArray
- Create a Host
- Create a Volume
- Connect a Volume to a Host
- 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.
$FlashArray = Connect-Pfa2Array -Endpoint <your_ip_fqdn> -Credential (Get-Credential) -IgnoreCertificateError
Once connected, I query the
$FlashArray variable and can see the
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.
$wwns = @('1122334455667788','2233445566778899') New-Pfa2Host -Name Uni -Wwns $wwns
Step 3: Create a Volume
New-Pfa2Volume -Name SpicyTunaRoll -Provisioned 1TB
Step 4: Connect a Volume to a Host
New-Pfa2Connection -HostNames Uni -VolumeNames SpicyTunaRoll
Step 5: Create a Volume Snapshot
New-Pfa2VolumeSnapshot -SourceNames SpicyTunaRoll
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 add 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!
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.
Here is a list of resources that can help get you started with the SDK.
- Microsoft Platform Guide How-To articles
- Pure Storage Slack Workspace
- Self-invite at https://codeinvite.purestorage.com then head over to https://code-purestorage.slack.com.
- Join the #pfa-powershell channel and start a conversation.
- Example scripts on https://github.com/purestorage-openconnect.
The team looks forward to talking with you and we are listening!
Cheers – Barkz