Best Practice: Using -Version Parameter with New-PfaArray cmdlet

The Pure Storage PowerShell SDK supports our REST API from 1.0 — 1.13 today. If you want to know what the highest version that is supported by a FlashArray use the below URL and see the results of “version”. The SDK supports backward compatibility for previous versions of the REST API.

To view the REST API versions available on your FlashArray use the below URL.

https://{FlashArray_Name}/api/api_version
{"version": ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "1.12", "1.13"]}

Below is how to use the New-PfaArray cmdlet to connect to a FlashArray. In the example you’ll see the use of -Version 1.13. As a best practice using this parameter helps to ensure backward compatibility with your existing scripts. This is important with the SDK because as we introduce new REST API updates the SDK may not be on parity with the new REST version. As you are developing your scripts using this parameter will ensure they work. If this parameter is not specified it will default to using the highest version of REST that is available and could cause issues.

PS C:\> $FlashArray = New-PfaArray -EndPoint 10.21.201.57 -Credentials (Get-Credential) -Version 1.13 -IgnoreCertificateError

To explain why this is important let’s look at the New-PfaCertificateSigningRequest cmdlet. In REST 1.11 we did not support named certificates and any operations worked without using a name. Using REST the GET/cert method retrieves attributes of a single certificate. In REST 1.12+ we support named certificates. Using the previous REST call in 1.12 (GET/cert) would fail. You would need to use GET/cert/<certname> to retrieve specific attributes for that certificate. In the current SDK 1.13 we do not support named certificates only single certificates.

Without using the -Version parameter when establishing the FlashArray connection a script would fail as it defaults to the highest version of the REST API. But if you specify as you develop scripts this would work because it is targeting that specific REST API.

So to ensure the New-PfaCertificateSigningRequest cmdlet works the New-PfaArray cmdlet would be as follows:

PS C:\> $FlashArray = New-PfaArray -EndPoint -EndPoint {FQDN/IP} -Credentials (Get-Credential) -IgnoreCertificateError -Version 1.11

I hope this helps explain why it is a best practice to use -Version parameter and how it can help safe guard your scripts.

Thanks //barkz

Add Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

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