Now that the new toolkit has been released its time to start with an example of using some of the new cmdlets. The focus of this post is setting up replication connections between a FA-420 and an FA-405 using PowerShell.
The screenshots below show the two different arrays that will be connected for replication.
PureDemoArray (Target)
MFT-PURE1 (Source)
In order to setup the connection between both FlashArrays you need a Connection Key from the target. In order to get the details for any FlashArray using PowerShell the Get-PfaConfiguration cmdlet is used to retrieve all of the details for that particular array.
With a few more lines of PowerShell we can automatically connect the Replication Target and Replication Source without the need to go between the two web management GUIs.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Import–Module PureStoragePowerShell –WarningAction SilentlyContinue # 1) Connect to Replication Target Array and get the connection key $ReplTarget = Get–PfaApiToken –FlashArray 10.21.23.152 –Username pureuser –Password pureuser $ReplSession = Connect–PfaController –FlashArray 10.21.23.152 –API_Token $ReplTarget.api_token $ReplArray = Get–PfaConfiguration –FlashArray 10.21.23.152 –Session $ReplSession $ReplArray.ConnectionKey # 2) Connect to the Replication Source Array $SourceToken = Get–PfaApiToken –FlashArray 10.21.8.82 –Username pureuser –Password pureuser $SourceSession = Connect–PfaController –FlashArray 10.21.8.82 –API_Token $SourceToken.api_token New–PfaConnection –FlashArray 10.21.8.82 –ManagementAddress 10.21.23.152 ` –ConnectionKey $ReplArray.ConnectionKey –ReplicationAddress 10.21.23.153 –Session $SourceSession |
Note: I typically don’t use the ‘tick‘ mark for line continuation but I did in the above sample script for readability.
MSFT-PURE1 is now connected to the Replication Target array named PureDemoArray.
Viewing the PureDemoArray web management GUI we can see that the PureDemoArray is also connected to the Replication Source, MSFT-PURE1.
It is just as easy to remove replication connections using Remove-PfaConnection.
1 2 3 4 5 6 |
Import–Module PureStoragePowerShell –WarningAction SilentlyContinue $SourceToken = Get–PfaApiToken –FlashArray 10.21.8.82 –Username pureuser –Password pureuser $SourceSession = Connect–PfaController –FlashArray 10.21.8.82 –API_Token $SourceToken.api_token Remove–PfaConnection –FlashArray 10.21.8.82 –Name PureDemoArray –Session $SourceSession |
Thanks,
barkz