Skip to content

Repository files navigation

Pure Storage FlashBlade PowerShell Toolkit

PowerShell module for managing Pure Storage FlashBlade arrays via the REST API 2.x. Provides 526 cmdlets covering all FlashBlade REST 2.x endpoints with a Connect-PfbArray experience that mirrors the FlashArray PureStoragePowerShellSDK2 module.

Requirements

  • PowerShell 5.1 or later (Windows PowerShell or PowerShell 7+)
  • Posh-SSH (optional) — only needed for -Username/-Password/-Credential auth against arrays running REST API below 2.26 (Purity//FB < 4.8.1). See Authentication below.

Installation

From the PowerShell Gallery (recommended)

Install-Module-Name PureStorageFlashBladePowerShell -Scope CurrentUser
Import-Module PureStorageFlashBladePowerShell

From source (contributors / air-gapped environments)

The repo uses a flat layout (.psd1/.psm1 at the root, alongside Public//Private/); ./scripts/build.ps1 assembles the installable module folder:

# Clone the repository
git clone https://github.com/PureStorage-OpenConnect/flashblade-powershell.git
cd flashblade-powershell
# Build the module folder
./scripts/build.ps1
# Copy the built module to a PSModulePath locationCopy-Item-Recurse .\build\PureStorageFlashBladePowerShell `"$env:USERPROFILE\Documents\WindowsPowerShell\Modules\PureStorageFlashBladePowerShell"# ImportImport-Module PureStorageFlashBladePowerShell

Authentication

API Token (recommended)

The simplest way to connect. Generate a token from the FlashBlade GUI (Settings → Access → API Tokens) or CLI (pureadmin create --api-token).

$array=Connect-PfbArray-Endpoint 10.0.0.1-ApiToken "T-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"-IgnoreCertificateError

Username and Password

Connect using a local FlashBlade username and password — the same way you'd log into the GUI:

$password=ConvertTo-SecureString"MyPassword"-AsPlainText -Force
$array=Connect-PfbArray-Endpoint 10.0.0.1-Username "pureuser"-Password $password-IgnoreCertificateError

How it works under the hood:

When you provide -Username and -Password, the module checks whether the connected array supports native REST 2.x username/password login (FlashBlade REST API 2.26 / Purity//FB 4.8.1 and later). If so, it POSTs to the /api/login endpoint with { username, password } as a JSON body; the array returns a session token (x-auth-token) used for subsequent calls.

After successful login, the module attempts to retrieve a long-lived API token from /api/<ver>/admins/api-tokens?expose_api_token=true for the connected user. If none exists and the user has admin privileges, the module mints one with a POST to the same endpoint. The cached API token enables automatic reconnection if the session expires mid-run. This mirrors Connect-Pfa2Array from the FlashArray SDK.

SSH fallback for older arrays (< REST API 2.26 / Purity//FB 4.8.1):

FlashBlade has never had a REST-based way to exchange a username/password for a token below that version, so on older arrays -Username/-Password (and -Credential) instead fall back to SSH: the module connects over SSH and runs the pureadmin CLI to retrieve or mint an API token. This path requires the optional Posh-SSH module:

Install-Module-Name Posh-SSH -Scope CurrentUser

Posh-SSH is not a hard dependency of this module — it's only imported when the SSH fallback actually runs (i.e., only against arrays below REST API 2.26). If it isn't installed and the fallback is needed, Connect-PfbArray throws an error naming the exact install command, plus non-SSH alternatives (-ApiToken, or certificate/OAuth2 auth). Arrays on REST API 2.26+ never touch this path at all.

PSCredential

Same as username/password, but using a standard PowerShell credential object.

$cred=Get-Credential$array=Connect-PfbArray-Endpoint 10.0.0.1-Credential $cred-IgnoreCertificateError

You can also pre-cache credentials for reuse across multiple connections:

Set-PfbCredential-Credential (Get-Credential)
$array=Connect-PfbArray-Endpoint 10.0.0.1-Credential (Get-PfbCredential) -IgnoreCertificateError

Certificate (OAuth2/JWT)

For automated/service-account workflows using certificate-based authentication:

$array=Connect-PfbArray-Endpoint 10.0.0.1-Username "pureuser"`-ClientId "9472190-f792-712e-a639-0839fa830922"`-Issuer "myapp"-KeyId "e50c1a8f-..."`-PrivateKeyFile "C:\keys\fb-private.pem"-IgnoreCertificateError

Note:-PrivateKeyPassword (encrypted private keys) requires PowerShell 7+. Windows PowerShell 5.1 can only use unencrypted (plain) private key files with this flow; supplying -PrivateKeyPassword under Windows PowerShell 5.1 throws a clear error rather than connecting.

The -IgnoreCertificateError flag

Most FlashBlade arrays use self-signed SSL certificates. Pass -IgnoreCertificateError to bypass certificate validation. This is standard for lab and on-prem environments.

Usage

Basic workflow

# Connect to the array$array=Connect-PfbArray-Endpoint 10.0.0.1-ApiToken $token-IgnoreCertificateError
# All subsequent cmdlets use the connection automaticallyGet-PfbArray# Array name, model, Purity versionGet-PfbArraySpace# Capacity and usageGet-PfbHardware# Blades, drives, chassis# Disconnect when doneDisconnect-PfbArray

Managing file systems

# List all file systemsGet-PfbFileSystem# Create a file system (1 TB provisioned)New-PfbFileSystem-Name "project-data"-Attributes @{ provisioned=1TB }
# Update propertiesUpdate-PfbFileSystem-Name "project-data"-Attributes @{ provisioned=2TB }
# Take a snapshotNew-PfbFileSystemSnapshot-SourceName "project-data"-Suffix "daily-backup"# List snapshotsGet-PfbFileSystemSnapshot# Clean upRemove-PfbFileSystemSnapshot-Name "project-data.daily-backup"Remove-PfbFileSystem-Name "project-data"

Object store (S3)

# List accounts, users, and bucketsGet-PfbObjectStoreAccountGet-PfbObjectStoreUserGet-PfbBucket# Create a bucketNew-PfbBucket-Name "logs-bucket"-Attributes @{ account="myaccount" }

Filtering and pagination

# Filter by nameGet-PfbFileSystem-Filter "name='project-data'"# Pagination is automatic — all results are returned by defaultGet-PfbFileSystemSnapshot# Returns all snapshots, even if >1000

Multiple arrays

# Connect to two arrays$fb1=Connect-PfbArray-Endpoint 10.0.0.1-ApiToken $token1-IgnoreCertificateError
$fb2=Connect-PfbArray-Endpoint 10.0.0.2-ApiToken $token2-IgnoreCertificateError
# Target a specific array with -ArrayGet-PfbFileSystem-Array $fb1Get-PfbFileSystem-Array $fb2

WhatIf / Confirm support

All state-changing cmdlets (New, Update, Remove) support -WhatIf and -Confirm:

# Preview what would happen without making changesRemove-PfbFileSystem-Name "test-fs"-WhatIf
# Prompt for confirmation before each actionRemove-PfbFileSystem-Name "test-fs"-Confirm

Cmdlet Overview

CategoryVerbsExamples
ArrayGetGet-PfbArray, Get-PfbArraySpace, Get-PfbArrayPerformance
File SystemsGet, New, Update, RemoveGet-PfbFileSystem, New-PfbFileSystem
SnapshotsGet, New, RemoveGet-PfbFileSystemSnapshot
BucketsGet, New, Update, RemoveGet-PfbBucket, New-PfbBucket
PoliciesGet, New, Update, RemoveGet-PfbPolicy, New-PfbPolicyFileSystem
NetworkGet, New, Update, RemoveGet-PfbSubnet, Get-PfbNetworkInterface
HardwareGetGet-PfbHardware, Get-PfbBlade
AdminGet, New, Update, RemoveGet-PfbAdmin, Get-PfbAdminSetting
ReplicationGet, New, Update, RemoveGet-PfbBucketReplicaLink, Get-PfbTarget
CertificatesGet, New, Update, RemoveGet-PfbCertificate, New-PfbCertificate
SupportGet, New, Test, UpdateGet-PfbSupport, Test-PfbSupport

All cmdlets follow the Verb-PfbNoun naming convention. Run Get-Command -Module PureStorageFlashBladePowerShell for the full list.

Connection Object

Connect-PfbArray returns a connection object with these properties (aligned with PureStoragePowerShellSDK2):

PropertyDescription
EndpointHostname or IP of the connected FlashBlade
HttpEndpointFull base URL (https://endpoint)
UsernameAuthenticated username
ApiTokenAPI token used for the session
ApiVersionNegotiated REST API version (e.g., 2.12)
RestApiVersionAlias for ApiVersion (Pfa2 compat)

Getting Help

Every cmdlet has built-in help with examples:

# Detailed help for a specific cmdletGet-HelpConnect-PfbArray-Full
Get-HelpNew-PfbFileSystem-Examples
# List all available cmdletsGet-Command-Module PureStorageFlashBladePowerShell
# List cmdlets for a specific areaGet-Command-Module PureStorageFlashBladePowerShell -Noun PfbFileSystem*Get-Command-Module PureStorageFlashBladePowerShell -Noun PfbBucket*

Testing Results

v2.1.0 was validated on PowerShell 7 (the module runtime supports Windows PowerShell 5.1+).

Test AreaResult
Pester tests145 passed, 0 failed, 2 skipped (22 suites, pwsh 7); 143 passed, 0 failed, 4 skipped on Windows PowerShell 5.1
Module loads and exports526 cmdlets confirmed
Help coverage526/526 cmdlets have a Synopsis
Naming conventions526/526 follow Verb-PfbNoun pattern, all approved verbs
ShouldProcess (WhatIf/Confirm)304/304 array-mutating cmdlets (the 2 client-side credential cmdlets are exempt)
Live verification (PRs #4-8)Auth flows and affected cmdlets validated against real FlashBlade arrays on both sides of the REST API 2.26 threshold

Compatibility

  • FlashBlade: Purity//FB 3.x and later (REST API 2.x)
  • PowerShell: 5.1, 7.0+ (Windows, Linux, macOS)
  • Verified against: real FlashBlade arrays on both sides of the REST API 2.26 threshold

Migration from v1.x (PureFBModule)

This is a complete rewrite. Key changes:

  • Module name: PureStorageFlashBladePowerShell (was PureFBModule)
  • API: REST 2.x only (v1.x targeted REST 1.x)
  • Authentication: Session-based via Connect-PfbArray / Disconnect-PfbArray
  • Cmdlet naming: Verb-PfbNoun pattern with Get, New, Update, Remove verbs

Changelog

See CHANGELOG.md for the full version history.

License

Apache License 2.0 — see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages