New-PfaArrayCmdlet

To connect to a Pure Storage FlashArray the New-PfaArray cmdlet is used to create a secure connection from a host (Eg. Windows Server 2012 R2 or Windows 10) to the specificed FlashArray. A connection to the FlashArray is done over HTTPS using TLS 1.1/1.2.

The PowerShell SDK provides detailed help for each of the cmdlets. Use the Get-Help <cmdlet name> to retrieve the details. Windows PowerShell help provides serveral different methods to access varying detail levels that include -Examples, -Detailed or -Full. Using these different parameters will result in more detailed help or examples.

For example try the below in a Windows PowerShell session.

PS C:\> Get-Help New-PfaArray -Examples
NAME
New-PfaArray
SYNOPSIS
Logs onto the specified FlashArray.
-------------------------- EXAMPLE 1 --------------------------
PS C:\>$Array = New-PfaArray -EndPoint pure01.example.com -UserName pureuser -HttpTimeOutInMilliSeconds 300000 -Version 1.3
Using Version 1.3 of the REST API, connects to the FlashArray named "pure01.example.com" with pureuser's login
credentials. The cmdlet prompts for the login password and masks the password string on the screen.
The request times out if it takes longer than 300,000 milliseconds.
"$Array" can be used with the "-Array" parameter in subsequent cmdlets (for example, "Disconnect-PfaArray -Array
$Array").
-------------------------- EXAMPLE 2 --------------------------
PS C:\>$myCredential = Get-Credential
$myArray = New-PfaArray -EndPoint pure01.example.com -Credentials $myCredential -IgnoreCertificateError
Connects to the FlashArray named "pure01.example.com", ignoring any certificate errors.
First, the PowerShell command Get-Credential opens a pop-up to enter the login credentials, which are saved to
$myCredential.
-------------------------- EXAMPLE 3 --------------------------
PS C:\>$SecurePassword = ConvertTo-SecureString -String $ArrayPassword -AsPlaintext -Force
$Array = New-PfaArray -EndPoint pure01.example.com -username pureuser -Password $SecurePassword -IgnoreCertificateError
Connects to the FlashArray named "pure01.example.com", ignoring any certificate errors.
First, the PowerShell command ConvertTo-SecureString is used to convert a plain password to a secure string, which is
saved to $SecurePassword.
-------------------------- EXAMPLE 4 --------------------------
PS C:\>$Array = New-PfaArray -EndPoint pure01.example.com -UserName pureuser -RoleRequired ArrayAdmin
Connects to the FlashArray named "pure01.example.com" with pureuser's login credentials. The cmdlet prompts for the
login password and masks the password string on the screen.
The request times out if it takes longer than 300,000 milliseconds.
The request fails if the specified user does not have at least ArrayAdmin permission.
-------------------------- EXAMPLE 5 --------------------------
PS C:\>$Array = New-PfaArray -EndPoint pure01.example.com -ApiToken 99ce4e5a-3593-f724-4c44-e1a8c19c0c49 -IgnoreCertificateError
Connects to the FlashArray named "pure01.example.com", ignoring any certificate errors and using an API token for authentication

Authentication

As illustrated by the above examples when establishing a session using the PowerShell SDK there are three options to authenticate:

The below example uses the Credentials parameter to create a session to the Pure Storage FlashArray at 10.0.0.1 (EndPoint). The EndPoint can either be an IP address or a Fully Qualified Domain Name (FQDN). Once connected the session is stored as a PowerShell Object (PSObject) with the variable name of $FlashArray. The Credentials parameter is set to use the Windows PowerShell cmdlet Get-Credential which will prompt for a User name and Password.

Once the credentials have been entered and OK clicked the New-PfaArray cmdlet will complete the session.

Note that in the above example the IgnoreCertificateError is used as part of the New-PfaArray cmdlet. This parameter prevents certificate errors such as an unknown certificate issuer or non-matching names from causing the request to fail.

When using the Credentials method it is also possible to create a variable and assign the credentials to that variable.

$Creds = Get-Credential

Session Inspection

Once the session has been established the $FlashArray variable can be inspected to view the different properties.

Retrieving FlashArray Information

Now there is an active session to the FlashArray and this can be used to query the array for information. In order to use the current session the $FlashArray variable will be used in all subsequent cmdlets for the Array parameter. In the below example the FlashArray controller details are retrieved.

Any time information is retrieved from the FlashArray (GET operations) and assigned to variable it will return a PowerShell Object (PSObject). With the information stored as a PSObject individual properties can be queried, used as part of the pipeline or simply formatted.