Microsoft PowerShell Integration for Pure Storage FlashBlade......
FlashBlade: Scale out high performance file and object platform from Pure Storage.

Microsoft PowerShell Integration for Pure Storage FlashBlade......

One of the reasons I joined Pure almost 6 years ago now was the API first approach to storage management. Having been in the storage and data management space for more years than I care to admit, it was always a constant frustration working out how to integrate my platforms with other heterogeneous tools like a hypervisor, or a monitoring tool or more commonly in a full automation workflow framework. Typically these third-party tools would have to have some kind of plug-in written to talk to my SMI-S provider and if you changed functionality then you had to release a new plug-in.

Just to be clear, I am not a coder - however, I do like to dabble a bit in Python, PowerShell, Go and other languages that are common in my customers environments.

Pure has had RestFul tools for the FlashArray for ever with both Python and PowerShell and more recently Ansible and other open-source tools. Check out the Pure Storage Developer Community at https://code.purestorage.com/.

I like to say I helped #Barkz (Pure's PowerShell wizard) in the early days as he built the FlashArray PowerShell Toolkit, so when he asked me if I would own the FlashBlade toolkit I was both honoured and a bit "freaked out" that I may not be able to do it justice, however I rose to the challenge.

And so, the Pure Storage Open-Connect PowerShell Toolkit for FlashBlade was born.

https://github.com/PureStorage-OpenConnect/flashblade-powershell-toolkit

Installation & Usage

Using the REST API consists of the following steps:

1.      Generate the API token. This is a one-time step.

2.     Create the REST session, using the API token and capturing the returned x-auth-token.

3.     Submit REST API requests, using the x-auth-token.

4.     Invalidate the REST session.

The session is valid until it is ended or experiences 30 minutes of inactivity. Every cmdlet in the module will log out of its session after its process completes.

Each REST API request is comprised of a complete URL. The complete URL used to make a Purity//FB REST request includes the following components: Method (GET, POST, PUT, PATCH, or DELETE), Purity array REST API version and URI

Each cmdlet begins with Get-Pfb, Add-Pfb, Update-Pfb or Remove-Pfb e.g. Get-PfbFileSystems

This version can be called either with a JSON control file called FlashBlade.JSON, or by parsing -FlashBlade 'FQDN or IP' -APIToken 'FB Token'

The JSON control file holds :

  1. The FQDN or IP of the FlashBlade to be managed.
  2. The API Token of the user processing the commands.
  3. The version of the API that you wish to call.
  4. Whether you wish to skip validating your SSL Certificates.

Example JSON file:

[ { "FlashBlade": "xxx.xxx.xxx.x", "APIToken": "xxx", "APIvers": 1.8, "SkipCertificateCheck": "True" } ]

Examples:

Get running array configuration

PS> Get-PfbArray

Running function: Get-PfbArray

---------------------------------------------------

name    : RedDotFB

id     : 748be8f7-2c58-481f-bb36-b436e94c72b0

 os     : Purity//FB

 revision  : 2019.09.12_d6685bd0

 version  : 2.4.3

 time_zone : Asia/Singapore

 ntp_servers : {10.226.224.101}

 _as_of   : 1579050294287


Display all filesystems that start with zz

PS > Get-PfbFilesystem -Filter 'name="zz*"'

Running function: Get-PfbFilesystem

---------------------------------------------------

name             : zz-aptest4

 created           : 1553671407000

 fast_remove_directory_enabled : False

 snapshot_directory_enabled  : False

 destroyed          : False

 time_remaining        :

 nfs       : @{enabled=False; rules=*(rw,no_root_squash); v3_enabled=False; v4_1_enabled=False}

 smb             : @{enabled=False; acl_mode=shared}

 http             : @{enabled=False}

 provisioned         : 107374182400

 hard_limit_enabled      : False

 default_user_quota      : 0

 default_group_quota     : 0

 space            : @{virtual=0; unique=0; snapshots=0; data_reduction=; total_physical=0}

 id              : 5aa3833f-dd3a-b1df-f71f-66b0a8d6d1de

Other functions:

I would like to think anything you can do in the GUI or CLI you can do via REST.

Some examples would be:

Create, modify, delete, list filesystems or buckets.

Add Users, Quotas, Groups.

Modify LAGS and other network related tasks.

Help:

All help and examples can be found with the builtin cmdlet Get-Help

PS> Get-Help Add-PfbFilesystem -example

NAME

    Add-PfbFilesystem

 

SYNOPSIS

    Creates a file system on the current array.

    -------------------------- EXAMPLE 1 --------------------------

  PS> Add-PfbFilesystem -InputFile 'name of JSON file'

  PS> Add-PfbFilesystem  -Attributes '{"name":"powershell","provisioned":"10000","nfs":{"v3_enabled":"true"} } ‘

Get-Help <cmdlet name>

Get-Help <cmdlet name> -example

Get-Help <cmdlet name> -full

It has been fun creating the tool, and I am now looking forward to building some more advanced functionality for common tasks into it.

I will try and get this up on the PowerShell Gallery shortly to make it easier to consume.

Enjoy.

Feel free to reach out to me on twitter @KiwiStorageGuy or aj at puresorage.com with any questions.

To view or add a comment, sign in

More articles by Alex J.

  • FlashBlade PowerShell ToolKit 3.2.3

    Today I released an updated PowerShell toolkit for the Pure Storage FlashBlade. This release can only be found on the…

    3 Comments
  • FlashBlade, Elasticsearch and Kibana...

    I was asked recently how I could use the ELK stack to view filesystem information scraped from a FlashBlade. It was a…

  • FlashBlade Management with PowerShell 6+

    Storage Management does not have to be hard!! If you have been a storage admin at any time in your life, you will know…

    2 Comments
  • Business Lessons From a Boat Race

    Yesterday Emirates Team New Zealand (ETNZ) took the Americas Cup from Oracle Team USA (OTUSA) and it was a great day to…

    2 Comments

Others also viewed

Explore content categories