As illustrated by the above examples, when establishing a session using the PowerShell SDK, there are three options to authenticate:
- Username and Password
$FlashArray = New-PfaArray -EndPoint 10.0.0.1 -UserName pureuser -Password (ConvertTo-SecureString -String 'mypassword' -AsPlainText -Force) -IgnoreCertificateError
Note:
When using the
UserName and
Password parameter method of creating a session notice in the above example that the Password parameter requires that it be a secure string.
-
API Token
$FlashArray = New-PfaArray -EndPoint 10.0.0.1 -ApiToken fbbb3xyz-b2da-0000-3d7d-c5604a900000
-
Credentials
$FlashArray = New-PfaArray -EndPoint 10.0.0.1 -Credentials (Get-Credential)
The below example uses the
Credentials parameter to create a session to the Everpure 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.
PS C:\> $FlashArray = New-PfaArray -EndPoint 10.0.0.1 -Credentials (Get-Credential) -IgnoreCertificateError
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
PS C:\>
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.
Note:
When using the Credentials method it is also possible to create a variable and assign the credentials to that variable.
$Creds = Get-Credential