Setup Replication Connections using PowerShell

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 between a FA-420 and an FA-405.

The screenshots below show the two different arrays that will be connected for replication.

PureDemoArray (Replication Target)


MFT-PURE1 (Replication Source)

In order to setup the connection between both FlashArray’s you need a Connection Key from the replication 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.

Import-Module PureStoragePowerShell -WarningAction SilentlyContinue

# 1) Connect to Replication Target Array and get the connection key
$ReplTarget = Get-PfaApiToken -FlashArray -Username pureuser -Password pureuser
$ReplSession = Connect-PfaController -FlashArray -API_Token $ReplTarget.api_token
$ReplArray = Get-PfaConfiguration -FlashArray -Session $ReplSession

# 2) Connect to the Replication Source Array
$SourceToken = Get-PfaApiToken -FlashArray -Username pureuser -Password pureuser
$SourceSession = Connect-PfaController -FlashArray -API_Token $SourceToken.api_token
New-PfaConnection -FlashArray -ManagementAddress `
    -ConnectionKey $ReplArray.ConnectionKey -ReplicationAddress -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 a connection using Remove-PfaConnection.

Import-Module PureStoragePowerShell -WarningAction SilentlyContinue

$SourceToken = Get-PfaApiToken -FlashArray -Username pureuser -Password pureuser
$SourceSession = Connect-PfaController -FlashArray -API_Token $SourceToken.api_token

Remove-PfaConnection -FlashArray -Name PureDemoArray -Session $SourceSession


Here is a quick video that shows everything working live.


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.