In chapter 3 of this blog series, I showed you how to connect a vCloud Director to Veeam Backup & Replication. Before Veeam Backup & Replication 9.5 Update 4, the main usage of vCloud Director was to make backups of vCloud VMs. But now with Update 4, we can use vCloud Director as a target for Cloud Connect replicas.
Again, we first need the correct credentials. But now with vCloud Director Veeam Cloud Connect doesn’t use its local users, rather it maps tenants to existing vCloud Director organizations. In my lab this is the configuration I have so far:
The customer “vcc-tenant2” wants to consume Cloud Connect, so I first created for them a dedicated vDC named “DR”. You can use any vDC belonging to the organization as a target for Cloud Connect by the way, I just thought it would have been a good use case to have a tenant with both production VMs already running in vCloud Director, and also a new vDC to replicate VMs from another location.
Now, we need to give this customer access to Cloud Connect. The piece of code to do so is this:
# Load some useful functions function Show-Options { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string] $Message, [Parameter(Mandatory = $true)] [string[]] $Options ) Write-Host -Object "`n$Message`n" foreach ($option in $Options) { Write-Host -Object "`t[$($Options.IndexOf($option) + 1)] $($option)" } } function Get-UserChoice { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string] $Message, [Parameter(Mandatory = $true)] [string[]] $Options ) $inputIsValid = $false do { try { [int]$userInput = (Read-Host -Prompt "`n$Message") } catch { Write-Host -Object "Invalid input! Must be an integer." continue } if ($userInput -ge 1 -and $userInput -le $Options.Length) { $inputIsValid = $true } else { Write-Host -Object "Invalid input! Must be in the range 1..$($Options.Length)." } } until ($inputIsValid) return $userInput - 1 } ###### # Connect to vCloud director and Veeam server $vbrserver = "vbr.cloudconnect.local" $vbruser = "Administrator" $vbrpwd = "********" asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue Connect-VBRServer -Server $vbrserver -User $vbruser -Password $vbrpwd # Create VCD tenant $all_vcd_orgs = Find-VBRvCloudEntity -Organization Show-Options -Message "These are the available vCloud Organizations:" -Options $all_vcd_orgs.Name $vcd_org = Get-UserChoice -Message "Choose a vCloud organization" -Options $all_vcd_orgs $org = $all_vcd_orgs[$vcd_org] Add-VBRvCDCloudTenant -Description $org.Name -vCDOrganization $org
Ok, the first 60 lines are a couple of nice functions I found that makes it easy to create a selection menu. The interesting part for us is at the end. After we connect to the Veeam Server, we list all the existing vCD organizations, we ask the operator which one he wants to enable in Cloud Connect, and we create thew new Cloud Connect tenant:
The tenant is created with no resources, but you can see that it’s of the type “vCloud Director”:
The next part of the script goes and enables replication:
There are two gateway pools (see this previous post about how to create them), and the script also shows me the two available vDCs. I choose the DR one, and the script enables the replication towards this one in Cloud Connect:
This is the code used for the second part of the script:
### Assign replica resources to the VCD tenant # Choose a gateway pool $all_cgpools = Get-VBRCloudGatewayPool Show-Options -Message "These are the available Cloud Gateway Pools:" -Options $all_cgpools.Name $cgpool = Get-UserChoice -Message "Choose a Cloud Gateway Pool" -Options $all_cgpools $pool = $all_cgpools[$cgpool] # Choose a vDC $orgID = $org.OrganizationId $all_vdc = Find-VBRvCloudEntity -OrganizationVdc | Where {$_.OrganizationID -eq $orgID} Show-Options -Message "These are the vDC belonging to this Org:" -Options $all_vdc.Name $rpl_vdc = Get-UserChoice -Message "Choose a vDC" -Options $all_vdc $vdc = $all_vdc[$rpl_vdc] # Enable replication $org_options = New-VBRvCDOrganizationvDCOptions -OrganizationvDC $vdc $vcd_rpl_resources = New-VBRvCDReplicationResource -OrganizationvDCOptions $org_options $rpl_org = Get-VBRCloudTenant -Name $org.Name Set-VBRvCDCloudTenant -vCDCloudTenant $rpl_org -vCDReplicationResource $vcd_rpl_resources -GatewayPool $pool -GatewaySelectionType GatewayPool -EnableGatewayFailover -MaxConcurrentTask 1 Disconnect-VBRServer