Registering VASA providers is the first step in setting up VVols for a given vCenter, so automating this process is something that might be of interest to folks. We currently have this process in our vSphere Plugin, as well as in our vRO plugin, and of course you can do it manually. What about PowerShell? Well we have that too!
In our PowerShell Pure/VMware module there are three new cmdlets:
- new-pfavasaprovider
- get-pfavasaprovider
- remove-pfavasaprovider
These cmdlets require the 1.2.0.0 version of later of the module, so make sure you run update-module to have the latest.
How are these different than the built-in PowerCLI cmdlets new-vasaprovider, get-vasaprovider, remove-vasaprovider? Well functionally they are not, but they just make it simpler in context to a FlashArray.
When you connect to a FlashArray via PowerShell, we create a FlashArray object that allows for operations against that array.
new-pfaConnection -endpoint flasharray-420-1.purecloud.com -credentials (get-credential) -nonDefaultArray -ignoreCertificateError
The new-pfaconnection cmdlet stores the connection object in a variable called $Global:AllFlashArrays
As you authenticate more, they will be added to this object and can be addressed directly via indexing:
Okay, now that we authenticated, we can use the new cmdlets:
New-PfaVasaProvider
This will take in a FlashArray connection and then register the two VASA providers for that FlashArray to the connected vCenter (you must connect first using connect-viserver).
There are three parameters:
- FlashArray–this allows you to pass in one or more FlashArray connections. The cmdlet will then register both VASA providers for each connection.
- Credentials–these are the credentials for VASA (storage admin level credentials). If you do not specify this, you will be prompted interactively. If the credentials are wrong, it will also prompt for the right ones.
- AllFlashArrays–this is a switch parameter that you can supply instead of passing in any connection. It will then register all of the FlashArrays that are currently in the $Global:AllFlashArrays parameter.
The above will prompt for credentials. Or you can pass them in directly in the cmdlet with -credentials:
$creds = Get-Credential New-PfaVasaProvider -flasharray $Global:AllFlashArrays[0] -credentials $creds
If one or more providers are already registered it will just spit out a warning and skip it:
Otherwise, it will return the new VASA providers that have been registered.
NOTE: You must be on PowerCLI version 11.3 or later for this to work. There was a bug in previous versions that did not allow registering more than one VASA provider per array.
Get-PfaVasaProvider
This returns the active VASA provider for a given FlashArray connection:
So pass in a FlashArray connection, it will then return the one that is marked by vCenter as the active one.
Remove-PfaVasaProvider
The last one is for removing the providers. Pass in a FlashArray connection and it will remove all of the identified VASA providers for that array.
Note that this requires confirmation and the confirmation level is set to High.
To accept all removals at once enter an A instead of Y:
To make it entirely interactive, change the confirm parameter to false. This will allow all providers for that array to be removed without asking:
remove-PfaVasaProvider -flasharray $Global:AllFlashArrays[0] -Confirm:$False
Enjoy!