Pure1 PowerShell Module 1.3.0.0, Alerts, Support Contracts, Easier authentication, Custom REST tutorial.

Just pushed out a new release of the Pure Storage Pure1 PowerShell module. Not nearly as significant of a release as 1.2.0.0, but still a couple of notable things.

As usual update with update-module PureStorage.Pure1:

The first update is simplified authentication. The first time you authenticate, you need to run New-PureOneCertificate–on Windows this will create a self-signed x509 certificate, and if run on Linux or Mac it will create an RSA key pair. By default it will store it in the user directory first logged into when running PowerShell core:

You can specify your own directory of course or even create your own certificates/key pairs. But if you run this cmdlet, it will do it for you. Once you register it with Pure1, you can then pass in the key (and the private key password) to New-PureOneConnection to authenticate and then interact with the API:

In the 1.3.0.0 release, I made this a bit easier. If you used the default operation and left the key in the default place, if the key is not passed in, it will look in that place.

So all you need to do is pass in the Pure1 API key and enter in the RSA private key password.

Get-PureOneAlert

This is a new cmdlet to pull all array alerts from Pure1.

Oops I am out of support

This will return all open alerts. If you want to see all closed alerts, add the -closed parameter:

It also supports the -Severity parameter allowing you to specify critical, hidden, info, or warning. In PowerShell Core, hit tab to see the options:

You can also specify by array name:

or ID:

Or of course a combination:

Get-PureOneSupportContract

This returns all of the support contracts for array listed in your Pure1 organization(s).

This will return array information and the start and end date of the support contract. You can filter by array name or ID like in the alert cmdlet.

Not new but helpful!

So the Pure1 REST is be consistently updated and improved, what if a cmdlet does not exist yet!? Well the module does have an answer for that. New-PureOneOperation. This wraps the underlying REST authentication and specifics of the Pure1 REST, to make it easy to make REST calls. In fact, every cmdlet uses it.

So let’s say I want to get information out of Pure1 about my array’s drives, which is the following API:

https://static.pure1.purestorage.com/api-swagger/index.html#/Drives/get_api_1_latest_drives

So to run this, it is a GET operation against drives, so:

RestOperationType is GET and the ResourceType is drives. Easy.

If you want to filter, you can do that too. Let’s look at one drive:

id       : bacb3af4-414b-1c3b-5d74-5d768f5f355f
name     : SH0.BAY0
arrays   : {@{id=6351565c-d839-4174-bc0c-b82c63fa8c06; name=sn1-405-c12-21; resource_type=arrays; drive_count=24; fqdn=s
n1-405-c12-21.purecloud.com; total_capacity=7002267867910}}
capacity : 2147483648
details  :
protocol : SAS
status   : healthy
type     : NVRAM
_as_of   : 1600998664000

Let’s say I want to filter on all drives from the array listed above sn1-405-c12-21. The property is named arrays.name for the array name, so:

New-PureOneOperation -ResourceType drives -RestOperationType GET -QueryFilter "?filter=arrays.name='sn1-405-c12-21'"

You can get more specific with two filters, the array name and the drive name:

New-PureOneOperation -ResourceType drives -RestOperationType GET -QueryFilter "?filter=arrays.name='sn1-405-c12-21' and name='SH0.BAY9'"

Put the strings you are searching for in single quotes and connect each filter with operators. See this document for more details on filtering:

https://support.purestorage.com/Pure1/Pure1_Manage/Pure1_Manage_-REST_API/Pure1_Manage-_REST_API__Reference#Filtering

Lastly, a nice part of using this cmdlet is that is also automatically understands continuation tokens (if there are more than 1,000 results the Pure1 REST will send them in segments) and it will connect them all together for you automatically in PowerShell. It also handles rate limit overages by waiting if it needs to for the counter to clear.

Enjoy! Feedback? Open up issues or requests here:

https://github.com/PureStorage-OpenConnect/PureStorage.Pure1/issues

6 Replies to “Pure1 PowerShell Module 1.3.0.0, Alerts, Support Contracts, Easier authentication, Custom REST tutorial.”

    1. No. This one is for Pure1, the toolkit is a one-off collection by one of our tech directors to help with Microsoft stuff. Similar to the PureStorage.FlashArray.VMware one and what it does for VMware. The SDK is the base module for FlashArray-only operations. While Pure1 has some of the same information, Pure1 does not provide the ability to make changes to arrays–it just queries call home data and other calculated metrics from Pure1.

  1. “Remember kids, the only difference between Science and screwing around is writing it down”

    If you quote, cite the source.

    1. I dont know the source. Adam Savage repeated it on air but he himself said he heard it from one of the show experts and liked it and repeated it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.