26 Commits

Author SHA1 Message Date
Wes Carroll e16d4d8105 Merge branch 'master' into AzureVpg_v2 2020-09-08 09:06:39 -04:00
Wes Carroll 50e03b36f5 Merge pull request #110 from ZertoPublic/Release
Release into Master
2020-09-08 08:55:07 -04:00
Wes Carroll 4531d2d53b Merge branch 'release_prep' into Release 2020-09-08 08:22:32 -04:00
Wes Carroll e6e6be9ede Bump Version 2020-09-08 08:21:10 -04:00
Wes Carroll 5c2dd620d8 Update for Release Notes 2020-09-08 08:20:29 -04:00
Wes Carroll 143d5f801e Start Param Params 2020-09-08 08:06:18 -04:00
Wes Carroll a5a91febcf Merge pull request #109 from jonsouzerto/master
Fixed issue 108
2020-09-04 10:28:45 -04:00
jonsouzerto bb5dbaa0d4 Update CHANGELOG.md
Added fix information
2020-09-03 12:50:49 -04:00
jonsouzerto e6b5777e64 Updated recovery host key
Attempting to resolve issue 108
2020-09-03 12:45:35 -04:00
Wes Carroll f46c620302 Create Add-ZertoAzureVpgVm Function 2020-08-28 13:59:07 -04:00
Wes Carroll 3c60b0c0f3 Create Help File for New-ZertoAzureVpg 2020-08-28 13:59:06 -04:00
Wes Carroll d832812c13 Spelling Typo 2020-08-28 13:59:06 -04:00
Wes Carroll 80e0db3883 Create Add-ZertoAzureVpg function 2020-08-28 13:59:06 -04:00
Wes Carroll 809f9af60d Create Get-ZertoAzureResource function tests 2020-08-28 13:59:06 -04:00
Wes Carroll 5a9cba00d5 Get-ZertoAzureResource Help Creation 2020-08-28 13:59:06 -04:00
Wes Carroll 549238a22d Update Changelog with changes 2020-08-28 13:59:06 -04:00
Wes Carroll 253c9ba1b9 Add siteidentifier valid site validation 2020-08-28 13:59:06 -04:00
Wes Carroll 794f87dbf8 Add helpmessages for each switch 2020-08-28 13:59:06 -04:00
Wes Carroll ca45adcd5d Azure VPG Helper Functions Consolidated 2020-08-28 13:59:06 -04:00
Wes Carroll 5a3f2d8eec Azure VPG Helper Functions Creation 2020-08-28 13:59:06 -04:00
Wes Carroll ddee165575 Merge pull request #107 from gdbarron/invoke-move-updates
Invoke-ZertoMove parameter, pipeline, and restructuring updates
2020-08-28 13:48:34 -04:00
Brownstein f0279633dd add missing .IsPresent for switch value 2020-08-28 13:43:22 -04:00
Brownstein 139e52f3e2 add new parameter to test 2020-08-27 15:28:01 -04:00
Brownstein eea6e95988 update test and help files 2020-08-27 15:08:28 -04:00
Brownstein 0630cbb20e new param sets, pipeline input 2020-08-21 21:04:15 -04:00
Wes Carroll 682750fc6d Merge pull request #106 from ZertoPublic/Release
Merge pull request #105 from ZertoPublic/master
2020-08-20 13:44:03 -04:00
12 changed files with 1273 additions and 71 deletions
+16
View File
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Zerto Virtual Manager
#### New
* Added `Get-ZertoAzureResource` function to the module. This function is designed to retrieve information about resources in Azure that can be utilized when creating VPGs targeting the specified Azure site. Please read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoAzureResource.md) for more information and examples.
## [1.5.1]
### Zerto Virtual Manager
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/108) with `New-ZertoVpg` where when specifying a single host as a recovery target, the host identifier was not properly assigned. - Thanks @jonsouzerto!
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/86) with `Invoke-ZertoMoveVpg` where parameters should have been mandatory in certain workflows. - Thanks @gdbarron!
## [1.5.0] ## [1.5.0]
### Zerto Virtual Manager ### Zerto Virtual Manager
@@ -0,0 +1,56 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll {
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
}
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 17 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 17
}
$ParameterTestCases = @(
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'SiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'SecurityGroup'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
@{ParameterName = 'Subnet'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
@{ParameterName = 'Network'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
@{ParameterName = 'VmInstanceType'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory, $Validation)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
param($ParameterName, $Validation)
Switch ($Validation) {
'None' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Count | Should -Be 3
}
'NotNullOrEmpty' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
default {
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Functional Unit Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+5 -4
View File
@@ -5,17 +5,18 @@ $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 20 parameters defined" { It "$global:function should have exactly 21 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 20 (Get-Command $global:function).Parameters.Count | Should -Be 21
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@{ParameterName = 'vpgIdentifier'; Type = 'Guid[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } @{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' } @{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
@{ParameterName = 'commitPolicyTimeout'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } @{ParameterName = 'commitPolicyTimeout'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'forceShutdown'; Type = 'Switch'; Mandatory = $false; Validation = $null } @{ParameterName = 'forceShutdown'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $true; Validation = $null } @{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $true; Validation = $null } @{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'ContinueOnPreScriptFailure'; Type = 'Switch'; Mandatory = $false; Validation = $null } @{ParameterName = 'ContinueOnPreScriptFailure'; Type = 'Switch'; Mandatory = $false; Validation = $null }
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' } @{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
) )
@@ -0,0 +1,170 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Add-ZertoAzureVpgVm {
[Cmdletbinding()]
param(
[Parameter(
Mandatory,
HelpMessage = "VPG Settings Identifier of the target VPG.",
ValueFromPipeline,
ValueFromPipelineByPropertyName
)]
[ValidateNotNullOrEmpty()]
[Guid]$VpgSettingsIdentifier,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$VmName,
[ValidateNotNullOrEmpty()]
[String]$LiveNetworkName,
[ValidateNotNullOrEmpty()]
[String]$LiveSubnetName,
[ValidateNotNullOrEmpty()]
[String]$LiveSecurityGroupName,
[ValidateNotNullOrEmpty()]
[String]$LiveInstanceType,
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
[String]$LiveDiskType,
[ValidateScript( { $_ -match [IPAddress]$_ })]
[String]$LiveIpAddress,
[ValidateNotNullOrEmpty()]
[String]$TestNetworkName,
[ValidateNotNullOrEmpty()]
[String]$TestSubnetName,
[ValidateNotNullOrEmpty()]
[String]$TestSecurityGroupName,
[ValidateNotNullOrEmpty()]
[String]$TestInstanceType,
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
[String]$TestDiskType,
[ValidateScript( { $_ -match [IPAddress]$_ })]
[String]$TestIpAddress,
[ValidateNotNullOrEmpty()]
[String[]]$TempDrive
)
begin {
}
process {
# Get Target Site Identifier from the settings for resource lookups
$TargetSiteIdentifier = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier -basic | Select-Object -ExpandProperty RecoverySiteIdentifier
# Add VM to VPG. Setting to Null as this function returns the VpgSettingsIdentifier
$null = Add-ZertoVpgVm -vpgSettingsIdentifier $VpgSettingsIdentifier -vm $VmName
# Getting the VmIdentifier
$VmIdentifier = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier -vms | Where-Object { $_.VmName -match $VmName } | Select-Object -ExpandProperty VmIdentifier
# Setting the URI fragment for use later
$VmSettingsUri = "vpgSettings/{0}/vms/{1}" -f $VpgSettingsIdentifier, $VmIdentifier
# Getting all default settings for the specified VM to update per passed parameters
$VmSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier -vmIdentifier $VmIdentifier
# Create Maps for quick lookups and validations
$NetworksMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Network) -Key "VirtualNetworkName" -Value "VirtualNetworkIdentifier"
$SubnetsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Subnet) -Key "SubnetName" -Value "SubnetIdentifier"
$SecurityGroupsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -SecurityGroup) -Key "SecurityGroupName" -Value "SecurityGroupIdentifier"
$Instances = Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -VmInstanceType
# Iterate through the bound parameters and set attributes accordingly
Switch ($PSBoundParameters.Keys) {
"LiveNetworkName" {
if ($null -eq $NetworksMap[$LiveNetworkName]) {
Write-Error "Unable to find network with name $LiveNetworkName. Please check the name and try again." -ErrorAction Stop
} else {
$VmSettings.Recovery.PublicCloud.Failover.VirtualNetworkIdentifier = $NetworksMap[$LiveNetworkName]
}
}
"LiveSubnetName" {
if ($null -eq $SubnetsMap[$LiveSubnetName]) {
Write-Error "Unable to find subnet with name $LiveSubnetName. Please check the name and try again." -ErrorAction Stop
} else {
$VmSettings.Nics[0].Failover.PublicCloud.SubnetIdentifier = $SubnetsMap[$LiveSubnetName]
}
}
"LiveSecurityGroupName" {
if ($null -eq $null -eq $SecurityGroupsMap[$LiveSecurityGroupName]) {
Write-Error "Unable to find security group with name $LiveSecurityGroupName. Please check the name and try again." -ErrorAction Stop
} else {
$VmSettings.Nics[0].Failover.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$LiveSecurityGroupName]
}
}
"LiveInstanceType" {
if ($LiveInstanceType -notin $Instances.VmInstanceType) {
Write-Error "Unable to find a supported VM Instance Type with name $LiveInstanceType. Please check the name and try again." -ErrorAction Stop
} else {
$LiveInstanceType = $Instances.Where( { $_.VmInstanceType -match $LiveInstanceType }) | Select-Object -ExpandProperty VmInstanceType
$VmSettings.Recovery.PublicCloud.Failover.VmInstanceType = $LiveInstanceType
}
}
"TestNetworkName" {
if ($null -eq $NetworksMap[$TestNetworkName]) {
Write-Error "Unable to find network with name $TestNetworkName. Please check the name and try again." -ErrorAction Stop
} else {
$VmSettings.Recovery.PublicCloud.FailoverTest.VirtualNetworkIdentifier = $NetworksMap[$TestNetworkName]
}
}
"TestSubnetName" {
if ($null -eq $SubnetsMap[$TestSubnetName]) {
Write-Error "Unable to find subnet with name $TestSubnetName. Please check the name and try again." -ErrorAction Stop
} else {
$VmSettings.Nics[0].FailoverTest.PublicCloud.SubnetIdentifier = $SubnetsMap[$TestSubnetName]
}
}
"TestSecurityGroupName" {
if ($null -eq $SecurityGroupsMap) {
Write-Error "Unable to find security group with name $TestSecurityGroupName. Please check the name and try again." -ErrorAction Stop
} else {
$VmSettings.Nics[0].FailoverTest.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$TestSecurityGroupName]
}
}
"TestInstanceType" {
if ($TestInstanceType -notin $Instances.VmInstanceType) {
Write-Error "Unable to find a supported VM Instance Type with name $TestInstanceType. Please check the name and try again." -ErrorAction Stop
} else {
$TestInstanceType = $Instances.Where( { $_.VmInstanceType -match $TestInstanceType }) | Select-Object -ExpandProperty VmInstanceType
$VmSettings.Recovery.PublicCloud.FailoverTest.VmInstanceType = $TestInstanceType
}
}
"LiveDiskType" {
$VmSettings.Recovery.PublicCloud.Failover.Azure.RecoveryDiskType = $LiveDiskType
}
"TestDiskType" {
$VmSettings.Recovery.PublicCloud.FailoverTest.Azure.RecoveryDiskType = $TestDiskType
}
"LiveIpAddress" {
$VmSettings.Nics[0].Failover.PublicCloud.PrivateIP = $LiveIpAddress
}
"TestIpAddress" {
$VmSettings.Nics[0].FailoverTest.PublicCloud.PrivateIP = $TestIpAddress
}
} # End Switch Statement
# Update the VPG VM Settings Object with the updated attributes
$null = Invoke-ZertoRestRequest -uri $VmSettingsUri -method PUT -body ($VmSettings | ConvertTo-Json -Depth 10)
# If any Temp Drives are specified, loop through them and set them as such
if ($PSBoundParameters.Keys -contains "TempDrive") {
foreach ($drive in $TempDrive) {
$driveUri = "{0}/volumes/{1}" -f $VmSettingsUri, $drive
$driveSettings = Invoke-ZertoRestRequest -uri $driveUri
$driveSettings.IsSwap = $True
$null = Invoke-ZertoRestRequest -uri $driveUri -method PUT -body ($driveSettings | ConvertTo-Json -Depth 10)
}
}
}
end {
}
}
@@ -0,0 +1,137 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZertoAzureResource {
[CmdletBinding(DefaultParameterSetName = "SiteNameVmInstanceType")]
param (
[Parameter(
Mandatory,
HelpMessage = "Name the Azure Site you wish to get the information.",
ParameterSetName = "SiteNameSecurityGroup"
)]
[Parameter(
Mandatory,
HelpMessage = "Name the Azure Site you wish to get the information.",
ParameterSetName = "SiteNameSubnet"
)]
[Parameter(
Mandatory,
HelpMessage = "Name the Azure Site you wish to get the information.",
ParameterSetName = "SiteNameNetwork"
)]
[Parameter(
Mandatory,
HelpMessage = "Name the Azure Site you wish to get the information.",
ParameterSetName = "SiteNameVmInstanceType"
)]
[ValidateNotNullOrEmpty()]
[String]$SiteName,
[Parameter(
Mandatory,
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
ParameterSetName = "SiteIdentifierSecurityGroup"
)]
[Parameter(
Mandatory,
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
ParameterSetName = "SiteIdentifierSubnet"
)]
[Parameter(
Mandatory,
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
ParameterSetName = "SiteIdentifierNetwork"
)]
[Parameter(
Mandatory,
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
ParameterSetName = "SiteIdentifierVmInstanceType"
)]
[ValidateNotNullOrEmpty()]
[String]$SiteIdentifier,
[Parameter(
Mandatory,
ParameterSetName = "SiteIdentifierSecurityGroup",
HelpMessage = "Use this switch to get information about the supported Security Groups"
)]
[Parameter(
Mandatory,
ParameterSetName = "SiteNameSecurityGroup",
HelpMessage = "Use this switch to get information about the supported Security Groups"
)]
[Switch]$SecurityGroup,
[Parameter(
Mandatory,
ParameterSetName = "SiteIdentifierSubnet",
HelpMessage = "Use this switch to get information about the supported Subnets"
)]
[Parameter(
Mandatory,
ParameterSetName = "SiteNameSubnet",
HelpMessage = "Use this switch to get information about the supported Subnets"
)]
[Switch]$Subnet,
[Parameter(
Mandatory,
ParameterSetName = "SiteIdentifierNetwork",
HelpMessage = "Use this switch to get information about the supported Networks (VNets)."
)]
[Parameter(
Mandatory,
ParameterSetName = "SiteNameNetwork",
HelpMessage = "Use this switch to get information about the supported Networks (VNets)."
)]
[Switch]$Network,
[Parameter(
Mandatory,
ParameterSetName = "SiteIdentifierVmInstanceType",
HelpMessage = "Use this switch to get information about the supported Vm Instance Types."
)]
[Parameter(
Mandatory,
ParameterSetName = "SiteNameVmInstanceType",
HelpMessage = "Use this switch to get information about the supported Vm Instance Types."
)]
[Switch]$VmInstanceType
)
begin {
}
process {
if ($PSCmdlet.ParameterSetName -match "SiteName") {
$SiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $SiteName }
if ($null -eq $SiteInfo) {
Write-Error "Unable to find a peer site with the name $SiteName. Please check your parameters and try again." -ErrorAction Stop
}
$SiteIdentifier = $SiteInfo | Select-Object -ExpandProperty SiteIdentifier
} else {
$SiteInfo = Get-ZertoPeerSite -siteIdentifier $SiteIdentifier
if ($null -eq $SiteInfo) {
Write-Error "Unable to find a peer site with identifier of $SiteIdentifier. Please check your parameters and try again." -ErrorAction Stop
}
}
if ($SiteInfo.SiteType -notmatch "Azure") {
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
}
$baseUri = "virtualizationsites/{0}/publicCloud" -f $SiteIdentifier
switch -wildcard ($PSCmdlet.ParameterSetName) {
"*VmInstanceType" {
$uri = "{0}/VmInstanceType" -f $baseUri
}
"*Subnet" {
$uri = "{0}/subnets" -f $baseUri
}
"*Network" {
$uri = "{0}/virtualNetworks" -f $baseUri
}
"*SecurityGroup" {
$uri = "{0}/securityGroups" -f $baseUri
}
}
Invoke-ZertoRestRequest -uri $uri
}
end {
}
}
+69 -40
View File
@@ -1,22 +1,57 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZertoMove { function Invoke-ZertoMove {
[CmdletBinding( DefaultParameterSetName = "main", SupportsShouldProcess = $true )] [CmdletBinding( DefaultParameterSetName = "id", SupportsShouldProcess = $true )]
param( param(
[Parameter( [Parameter(
ParameterSetName = 'name',
HelpMessage = "Name(s) of the VPG(s) you want to move.",
Mandatory
)]
[Parameter(
ParameterSetName = 'commitName',
HelpMessage = "Name(s) of the VPG(s) you want to move.", HelpMessage = "Name(s) of the VPG(s) you want to move.",
Mandatory Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
[Parameter( [Parameter(
ParameterSetName = 'id',
HelpMessage = "ID(s) of the VPG(s) you want to move.",
Mandatory,
ValueFromPipelineByPropertyName
)]
[Parameter(
ParameterSetName = 'commitId',
HelpMessage = "ID(s) of the VPG(s) you want to move.",
Mandatory,
ValueFromPipelineByPropertyName
)]
[ValidateNotNullOrEmpty()]
[guid[]]$vpgIdentifier,
[Parameter(
ParameterSetName = 'commitName',
HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back. HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site. 'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover. 'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
Default is the Site Settings setting." Default is the Site Settings setting.",
Mandatory
)]
[Parameter(
ParameterSetName = 'commitId',
HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
Default is the Site Settings setting.",
Mandatory
)] )]
[ValidateSet("Rollback", "Commit", "None")] [ValidateSet("Rollback", "Commit", "None")]
[string]$commitPolicy, [string]$commitPolicy,
[Parameter( [Parameter(
ParameterSetName = 'commitName',
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)]
[Parameter(
ParameterSetName = 'commitId',
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied." HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
)] )]
# Min 5 Minutes, Max 24 Hours, Default Site Settigns. # Min 5 Minutes, Max 24 Hours, Default Site Settigns.
@@ -27,15 +62,11 @@ function Invoke-ZertoMove {
)] )]
[switch]$forceShutdown, [switch]$forceShutdown,
[Parameter( [Parameter(
ParameterSetName = "disableReverseProtection", HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set."
HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.",
Mandatory
)] )]
[switch]$disableReverseProtection, [switch]$disableReverseProtection,
[Parameter( [Parameter(
ParameterSetName = "keepSourceVms", HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection."
HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.",
Mandatory
)] )]
[switch]$keepSourceVms, [switch]$keepSourceVms,
[Parameter( [Parameter(
@@ -46,54 +77,52 @@ function Invoke-ZertoMove {
begin { begin {
$baseUri = "vpgs" $baseUri = "vpgs"
$body = @{
forceShutdown = $forceShutdown.IsPresent
ContinueOnPreScriptFailure = $ContinueOnPreScriptFailure.IsPresent
keepSourceVms = $keepSourceVms.IsPresent
reverseProtection = -not $disableReverseProtection.IsPresent
}
if ( $keepSourceVms.IsPresent -and -not $disableReverseProtection.IsPresent ) {
Write-Verbose 'Disabling reverse protection as keepSourceVms requires it'
$body['reverseProtection'] = $false
} }
process {
$body = @{ }
#TODO - use a foreach loop to populate the body without all the if statments
if ($PSBoundParameters.ContainsKey('commitPolicy')) { if ($PSBoundParameters.ContainsKey('commitPolicy')) {
$body['commitPolicy'] = $commitPolicy $body['commitPolicy'] = $commitPolicy
}
if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) { if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) {
$body['commitPolicyTimeout'] = $commitPolicyTimeout $body['commitPolicyTimeout'] = $commitPolicyTimeout
} }
if ($PSBoundParameters.ContainsKey('forceShutdown')) {
$body['forceShutdown'] = $true
} else {
$body['forceShutdown'] = $false
} }
if ($PSBoundParameters.ContainsKey('ContinueOnPreScriptFailure')) {
$body['ContinueOnPreScriptFailure'] = $true
} else {
$body['ContinueOnPreScriptFailure'] = $false
} }
process {
switch ($PSCmdlet.ParameterSetName) { switch ($PSCmdlet.ParameterSetName) {
"disableReverseProtection" { { $_ -in 'name', 'commitName' } {
$body['reverseProtection'] = $false $vpgIds = foreach ($name in $vpgName) {
$body['keepSourceVms'] = $false
}
"keepSourceVms" {
$body['reverseProtection'] = $false
$body['keepSourceVms'] = $true
}
"main" {
$body['reverseProtection'] = $true
$body['keepSourceVms'] = $false
}
}
foreach ($name in $vpgName) {
$vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier $vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier
if ( -not $vpgId ) { if ( -not $vpgId ) {
Write-Error "VPG: $name not found. Please check the name and try again. Skipping" Write-Error "VPG: '$name' not found. Please check the name and try again. Skipping"
} else { } else {
$uri = "{0}/{1}/move" -f $baseUri, $vpgId Write-Verbose "VPG: $name, ID: $vpgId"
if ($PSCmdlet.ShouldProcess("Moving VPG: $name with settings: $($body | convertto-json)")) { $vpgId
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
} }
} }
} }
{ $_ -in 'id', 'commitId' } {
$vpgIds = $vpgIdentifier
}
}
foreach ($thisId in $vpgIds) {
$uri = "{0}/{1}/move" -f $baseUri, $thisId
if ($PSCmdlet.ShouldProcess("Moving VPG: $thisId with settings: $($body | ConvertTo-Json)")) {
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
}
}
} }
end { end {
@@ -0,0 +1,201 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function New-ZertoAzureVpg {
[CmdletBinding()]
# Ignoring Should Process PSSA rule. Change is in memory and not committed untill the Save-ZertoVpgSetting function is called.
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
param(
[Parameter(
Mandatory,
HelpMessage = "Desired name of the VPG to be created."
)]
[ValidateNotNullOrEmpty()]
[string]$Name,
[Parameter(
HelpMessage = "Replication priority of the VPG to be created. Default value is 'Medium'"
)]
[ValidateSet("High", "Medium", "Low")]
[string]$Priority = "Medium",
[Parameter(
HelpMessage = "Desired journal history in hours of the VPG to be created. Min 1 hour, Max 720 hours (30 days). Default is 24 hours."
)]
[ValidateRange(1, 720)]
[Int]$JournalHistoryInHours = 24,
[Parameter(
HelpMessage = "Desired RPO alert value in seconds. Min 60 seconds, Max 86400 seconds (24 hours). Default is 300 seconds (5 minutes)."
)]
[ValidateRange(60, 86400)]
[Int]$RpoInSeconds = 300,
[Parameter(
HelpMessage = "Desired test interval in minutes. Please review documentation for values. Default is 262080 minutes (6 months)."
)]
[ValidateSet(0, 43200, 131040, 262080, 394560, 525600)]
[Int]$TestIntervalInMinutes = 262080,
[Parameter(
HelpMessage = "Turn on or off WAN compression. Recommended this setting is not turned off. Default is to leave WAN compression turned on."
)]
[Bool]$UseWanCompression = $True,
[Parameter(
Mandatory,
HelpMessage = "Name of the ZCA site for the VPG to target."
)]
[ValidateNotNullOrEmpty()]
[String]$TargetSiteName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default Network (VNet) to use during a live operation."
)]
[ValidateNotNullOrEmpty()]
[String]$LiveNetworkName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default subnet to use during a live operation."
)]
[ValidateNotNullOrEmpty()]
[String]$LiveSubnetName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default Security Group to use during a live operation."
)]
[ValidateNotNullOrEmpty()]
[String]$LiveSecurityGroupName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default VM Instance Type to use during a live operation."
)]
[ValidateNotNullOrEmpty()]
[String]$LiveInstanceType,
[Parameter(
HelpMessage = "Type of disk to select as the default for the VPG during a live operation. Default is 'ManagedPremiumSSD'"
)]
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
[String]$LiveDiskType = "ManagedPremiumSSD",
[Parameter(
Mandatory,
HelpMessage = "Name of the default Network (VNet) to use during a test operation."
)]
[ValidateNotNullOrEmpty()]
[String]$TestNetworkName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default subnet to use during a test operation."
)]
[ValidateNotNullOrEmpty()]
[String]$TestSubnetName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default Security Group to use during a test operation."
)]
[ValidateNotNullOrEmpty()]
[String]$TestSecurityGroupName,
[Parameter(
Mandatory,
HelpMessage = "Name of the default VM Instance Type to use during a test operation."
)]
[ValidateNotNullOrEmpty()]
[String]$TestInstanceType,
[Parameter(
HelpMessage = "Type of disk to select as the default for the VPG during a live operation. Default is 'ManagedPremiumSSD'"
)]
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
[String]$TestDiskType = "ManagedPremiumSSD"
)
begin {
# Grab local site identifier and target site information and identifier
$LocalSiteIdentifier = Get-ZertoLocalSite | Select-Object -ExpandProperty SiteIdentifier
$TargetSiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $TargetSiteName }
$TargetSiteIdentifier = $TargetSiteInfo | Select-Object -ExpandProperty SteIdentifier
# Validate site identifier and site type.
if ($null -eq $TargetSiteIdentifier) {
Write-Error "Unable to find target site with name $TargetSiteName. Please check the name and try again" -ErrorAction Stop
} elseif ($TargetSiteInfo.SiteType -notmatch "Azure") {
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
}
# Build Maps for quick lookups and validation
$NetworksMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Network) -Key "VirtualNetworkName" -Value "VirtualNetworkIdentifier"
$SubnetsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Subnet) -Key "SubnetName" -Value "SubnetIdentifier"
$SecurityGroupsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -SecurityGroup) -Key "SecurityGroupName" -Value "SecurityGroupIdentifier"
$InstancesMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -VmInstanceType) -Key "VmInstanceType" -Value "IsPremiumSupported"
# Validate instance types and ensure case insensitivity
$TestInstanceType = $Instances.Where( { $_.VmInstanceType -match $TestInstanceType }) | Select-Object -ExpandProperty VmInstanceType
$LiveInstanceType = $Instances.Where( { $_.VmInstanceType -match $LiveInstanceType }) | Select-Object -ExpandProperty VmInstanceType
# Validate parameters are found at target site and Instance and Disk Types are valid
if ($null -eq $NetworksMap[$LiveNetworkName]) {
Write-Error "Unable to find network with name $LiveNetworkName. Please check the name and try again." -ErrorAction Stop
} elseif ($null -eq $SubnetsMap[$LiveSubnetName]) {
Write-Error "Unable to find subnet with name $LiveSubnetName. Please check the name and try again." -ErrorAction Stop
} elseif ($null -eq $SecurityGroupsMap[$LiveSecurityGroupName]) {
Write-Error "Unable to find security group with name $LiveSecurityGroupName. Please check the name and try again." -ErrorAction Stop
} elseif ($LiveInstanceType -notin $Instances.VmInstanceType) {
Write-Error "Unable to find a supported VM Instance Type with name $LiveInstanceType. Please check the name and try again." -ErrorAction Stop
} elseif ($null -eq $NetworksMap[$TestNetworkName]) {
Write-Error "Unable to find network with name $TestNetworkName. Please check the name and try again." -ErrorAction Stop
} elseif ($null -eq $SubnetsMap[$TestSubnetName]) {
Write-Error "Unable to find subnet with name $TestSubnetName. Please check the name and try again." -ErrorAction Stop
} elseif ($null -eq $SecurityGroupsMap[$TestSecurityGroupName]) {
Write-Error "Unable to find security group with name $TestSecurityGroupName. Please check the name and try again." -ErrorAction Stop
} elseif ($TestInstanceType -notin $Instances.VmInstanceType) {
Write-Error "Unable to find a supported VM Instance Type with name $TestInstanceType. Please check the name and try again." -ErrorAction Stop
} elseif ($LiveDiskType -eq "ManagedPremiumSSD" -and ( -not $InstancesMap[$LiveInstanceType])) {
Write-Error "$LiveDiskType disk type is not supported on the selected instance $LiveInstanceType. Please check your settings and try again." -ErrorAction Stop
} elseif ($LiveDiskType -ne "ManagedPremiumSSD" -and $InstancesMap[$LiveInstanceType]) {
Write-Error "$TestDiskType disk type is not supported on the selected instance $LiveInstanceType. Please check your settings and try again." -ErrorAction Stop
} elseif ($TestDiskType -eq "ManagedPremiumSSD" -and ( -not $InstancesMap[$TestInstanceType])) {
Write-Error "$TestDiskType disk type is not supported on the selected instance $TestInstanceType. Please check your settings and try again." -ErrorAction Stop
} elseif ($TestDiskType -ne "ManagedPremiumSSD" -and $InstancesMap[$TestInstanceType]) {
Write-Error "$TestDiskType disk type is not supported on the selected instance $TestInstanceType. Please check your settings and try again." -ErrorAction Stop
}
# Create the VPG Settings Identifier and get the skeleton
$VpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -newVpg
$Settings = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier
# Set the VPG Settings URI
$VpgSettingsBaseUri = "vpgSettings/{0}" -f $VpgSettingsIdentifier
# Populate the skeleton with the basic information
$Settings.Basic.Name = $Name
$Settings.Basic.Priority = $Priority
$Settings.Basic.JournalHistoryInHours = $JournalHistoryInHours
$Settings.Basic.ProtectedSiteIdentifier = $LocalSiteIdentifier
$Settings.Basic.RecoverySiteIdentifier = $TargetSiteIdentifier
$Settings.Basic.RpoInSeconds = $RpoInSeconds
$Settings.Basic.TestIntervalInMinutes = $TestIntervalInMinutes
$Settings.Basic.UseWanCompression = $UseWanCompression
# Put the basic information to get am Azure Skeleton for the remainder of the default settings
$null = Invoke-ZertoRestRequest -method PUT -uri $VpgSettingsBaseUri -body ($Settings | ConvertTo-Json -Depth 10)
Start-Sleep -Milliseconds 500
# Get an updated Skeleton with Azure specific settings to populate and populate them
$Settings = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier
$Settings.Networks.Failover.PublicCloud.VirtualNetworkIdentifier = $NetworksMap[$LiveNetworkName]
$Settings.Networks.Failover.PublicCloud.SubnetIdentifier = $SubnetsMap[$LiveSubnetName]
$Settings.Networks.Failover.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$LiveSecurityGroupName]
$Settings.Networks.FailoverTest.PublicCloud.VirtualNetworkIdentifier = $NetworksMap[$TestNetworkName]
$Settings.Networks.FailoverTest.PublicCloud.SubnetIdentifier = $SubnetsMap[$TestSubnetName]
$Settings.Networks.FailoverTest.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$TestSecurityGroupName]
$Settings.Recovery.PublicCloud.Failover.VmInstanceType = $LiveInstanceType
$Settings.Recovery.PublicCloud.Failover.Azure.RecoveryDiskType = $LiveDiskType
$Settings.Recovery.PublicCloud.FailoverTest.VmInstanceType = $TestInstanceType
$Settings.Recovery.PublicCloud.FailoverTest.Azure.RecoveryDiskType = $TestDiskType
# Update the VPG Settings on the Server with a PUT request
$null = Invoke-ZertoRestRequest -method PUT -uri $VpgSettingsBaseUri -body ($Settings | ConvertTo-Json -Depth 10)
# Return the VPG Settings Identifier to use when adding VMs to the VPG.
$VpgSettingsIdentifier
}
process {
}
end {
}
}
+2 -2
View File
@@ -295,11 +295,11 @@ function New-ZertoVpg {
"recoveryHostDatastoreCluster" { "recoveryHostDatastoreCluster" {
$baseSettings.Recovery.DefaultDatastoreClusterIdentifier = $identifiersTable['datastoreClusterIdentifier'] $baseSettings.Recovery.DefaultDatastoreClusterIdentifier = $identifiersTable['datastoreClusterIdentifier']
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier'] $baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier']
} }
"recoveryHostDatastore" { "recoveryHostDatastore" {
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier'] $baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier']
$baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier'] $baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier']
} }
+221
View File
@@ -0,0 +1,221 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoAzureResource.md
schema: 2.0.0
---
# Get-ZertoAzureResource
## SYNOPSIS
Function used to get data for the Azure site to populate VPGs targeting Azure. This information includes Networks (VNets), Subnets, Security Groups, and VM Instance Types.
## SYNTAX
### SiteNameVmInstanceType (Default)
```
Get-ZertoAzureResource -SiteName <String> [-VmInstanceType] [<CommonParameters>]
```
### SiteNameNetwork
```
Get-ZertoAzureResource -SiteName <String> [-Network] [<CommonParameters>]
```
### SiteNameSubnet
```
Get-ZertoAzureResource -SiteName <String> [-Subnet] [<CommonParameters>]
```
### SiteNameSecurityGroup
```
Get-ZertoAzureResource -SiteName <String> [-SecurityGroup] [<CommonParameters>]
```
### SiteIdentifierVmInstanceType
```
Get-ZertoAzureResource -SiteIdentifier <String> [-VmInstanceType] [<CommonParameters>]
```
### SiteIdentifierNetwork
```
Get-ZertoAzureResource -SiteIdentifier <String> [-Network] [<CommonParameters>]
```
### SiteIdentifierSubnet
```
Get-ZertoAzureResource -SiteIdentifier <String> [-Subnet] [<CommonParameters>]
```
### SiteIdentifierSecurityGroup
```
Get-ZertoAzureResource -SiteIdentifier <String> [-SecurityGroup] [<CommonParameters>]
```
## DESCRIPTION
Function used to get data for the Azure site to populate VPGs targeting Azure. This information includes Networks (VNets), Subnets, Security Groups, and VM Instance Types.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -Network
```
Returns information about the usable Networks (Vnets) at the Azure site with Zerto ZCA site named "My Azure Site"
### Example 2
```powershell
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -Subnet
```
Returns information about the usable Subnets at the Azure site with Zerto ZCA site named "My Azure Site"
### Example 3
```powershell
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -SecurityGroup
```
Returns information about the usable Security Groups at the Azure site with Zerto ZCA site named "My Azure Site"
### Example 4
```powershell
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -VmInstanceType
```
Returns information about the usable Vm Instance Types at the Azure site with Zerto ZCA site named "My Azure Site"
### Example 5
```powershell
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -Network
```
Returns information about the usable Networks (Vnets) at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
### Example 6
```powershell
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -Subnet
```
Returns information about the usable Subnets at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
### Example 7
```powershell
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -SecurityGroup
```
Returns information about the usable Security Groups at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
### Example 8
```powershell
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -VmInstanceType
```
Returns information about the usable Vm Instance Types at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
## PARAMETERS
### -Network
Use this switch to get information about the supported Networks (VNets).
```yaml
Type: SwitchParameter
Parameter Sets: SiteNameNetwork, SiteIdentifierNetwork
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SecurityGroup
Use this switch to get information about the supported Security Groups
```yaml
Type: SwitchParameter
Parameter Sets: SiteNameSecurityGroup, SiteIdentifierSecurityGroup
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SiteIdentifier
Site Identifier of the Azure Site you wish to get the information.
```yaml
Type: String
Parameter Sets: SiteIdentifierVmInstanceType, SiteIdentifierNetwork, SiteIdentifierSubnet, SiteIdentifierSecurityGroup
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SiteName
Name the Azure Site you wish to get the information.
```yaml
Type: String
Parameter Sets: SiteNameVmInstanceType, SiteNameNetwork, SiteNameSubnet, SiteNameSecurityGroup
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Subnet
Use this switch to get information about the supported Subnets
```yaml
Type: SwitchParameter
Parameter Sets: SiteNameSubnet, SiteIdentifierSubnet
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -VmInstanceType
Use this switch to get information about the supported Vm Instance Types.
```yaml
Type: SwitchParameter
Parameter Sets: SiteNameVmInstanceType, SiteIdentifierVmInstanceType
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS
[ZVM Azure Resource API Endpoint Documentation](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/virtualization_sites_api.htm#Availabl)
+55 -18
View File
@@ -12,22 +12,30 @@ Start a move of a VPG.
## SYNTAX ## SYNTAX
### main (Default) ### id (Default)
``` ```
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown] Invoke-ZertoMove -vpgIdentifier <Guid[]> [-forceShutdown] [-disableReverseProtection] [-keepSourceVms]
[-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
### disableReverseProtection ### commitName
``` ```
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown] Invoke-ZertoMove -vpgName <String[]> -commitPolicy <String> [-commitPolicyTimeout <Int32>] [-forceShutdown]
[-disableReverseProtection] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>] [-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
[<CommonParameters>]
``` ```
### keepSourceVms ### name
``` ```
Invoke-ZertoMove -vpgName <String[]> [-commitPolicy <String>] [-commitPolicyTimeout <Int32>] [-forceShutdown] Invoke-ZertoMove -vpgName <String[]> [-forceShutdown] [-disableReverseProtection] [-keepSourceVms]
[-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
```
### commitId
```
Invoke-ZertoMove -vpgIdentifier <Guid[]> -commitPolicy <String> [-commitPolicyTimeout <Int32>] [-forceShutdown]
[-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
[<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@@ -37,10 +45,24 @@ Start a move of a VPG.
### Example 1 ### Example 1
```powershell ```powershell
PS C:\> Invoke-ZertoMove -vpgName "MyVpg" PS C:\> Invoke-ZertoMove -vpgName 'MyVpg'
``` ```
Starts a move operation of VPG "MyVpg" Specify the name of a vpg to move
### Example 2
```powershell
PS C:\> Invoke-ZertoMove -vpgIdentifier '2fbbf6b5-cddc-4653-b1fe-564f069eeb64'
```
Specify the identifier of a vpg to move
### Example 3
```powershell
PS C:\> Get-ZertoVpg | Invoke-ZertoMove
```
Utilize the pipeline to move multiple vpgs
## PARAMETERS ## PARAMETERS
@@ -55,11 +77,11 @@ Default is the Site Settings setting.
```yaml ```yaml
Type: String Type: String
Parameter Sets: (All) Parameter Sets: commitName, commitId
Aliases: Aliases:
Accepted values: Rollback, Commit, None Accepted values: Rollback, Commit, None
Required: False Required: True
Position: Named Position: Named
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
@@ -72,7 +94,7 @@ If omitted, the site settings default will be applied.
```yaml ```yaml
Type: Int32 Type: Int32
Parameter Sets: (All) Parameter Sets: commitName, commitId
Aliases: Aliases:
Required: False Required: False
@@ -102,10 +124,10 @@ Do not enable reverse protection. The VPG definition is kept with the status Nee
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: disableReverseProtection Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: False
Position: Named Position: Named
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
@@ -132,13 +154,28 @@ Use this switch to Prevent the protected virtual machines from being deleted in
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: keepSourceVms Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vpgIdentifier
ID(s) of the VPG(s) you want to move.
```yaml
Type: Guid[]
Parameter Sets: id, commitId
Aliases: Aliases:
Required: True Required: True
Position: Named Position: Named
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False Accept wildcard characters: False
``` ```
@@ -147,7 +184,7 @@ Name(s) of the VPG(s) you want to move.
```yaml ```yaml
Type: String[] Type: String[]
Parameter Sets: (All) Parameter Sets: commitName, name
Aliases: Aliases:
Required: True Required: True
+334
View File
@@ -0,0 +1,334 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoAzureVpg.md
schema: 2.0.0
---
# New-ZertoAzureVpg
## SYNOPSIS
Creates a New VPG Settings object targeting an Azure ZCA. A Zerto VPG Settings Identifier will be returned to as the VPG will need to be updated with the Virtual Machines that will be members of this VPG.
## SYNTAX
```
New-ZertoAzureVpg [-Name] <String> [[-Priority] <String>] [[-JournalHistoryInHours] <Int32>]
[[-RpoInSeconds] <Int32>] [[-TestIntervalInMinutes] <Int32>] [[-UseWanCompression] <Boolean>]
[-TargetSiteName] <String> [-LiveNetworkName] <String> [-LiveSubnetName] <String>
[-LiveSecurityGroupName] <String> [-LiveInstanceType] <String> [[-LiveDiskType] <String>]
[-TestNetworkName] <String> [-TestSubnetName] <String> [-TestSecurityGroupName] <String>
[-TestInstanceType] <String> [[-TestDiskType] <String>] [<CommonParameters>]
```
## DESCRIPTION
Creates a New VPG Settings object targeting an Azure ZCA. A Zerto VPG Settings Identifier will be returned to as the VPG will need to be updated with the Virtual Machines that will be members of this VPG.
## EXAMPLES
### Example 1
```powershell
PS C:\> $VpgSettingsIdentifier = New-ZertoAzureVpg -Name "Example VPG" -Priority "Medium" -JournalHistoryInHours 24 -RpoInSeconds 300 -TestIntervalInMinutes 262080 -UseWanCompression $True -targetSiteName "My Azure Site" -liveNetworkName "Vnet_EastUS_Prod" -liveSubnetName "EUS-Subnet-1" -liveSecurityGroupName "SGP_East_Us_Prod" -LiveInstanceType "Standard_DS1_v2" -liveDiskType "ManagedPremiumSSD" -testNetworkName "Vnet_EastUS_Test" -testSubnetName "EUS-Subnet-2" -testSecurityGroupName "SGP_East_Us_Test" -testInstanceType "Standard_DS1_v2" -testDiskType "ManagedPremiumSSD"
```
Creates a VPG with the specified settings returning a Vpg Settings Identifier to the specified variable to be used in later steps creating the Vpg. All parameters are specified in this example.
### Example 2
```powershell
PS C:\> $VpgSettingsIdentifier = New-ZertoAzureVpg -Name "Example VPG" -targetSiteName "My Azure Site" -liveNetworkName "Vnet_EastUS_Prod" -liveSubnetName "EUS-Subnet-1" -liveSecurityGroupName "SGP_East_Us_Prod" -LiveInstanceType "Standard_DS1_v2" -testNetworkName "Vnet_EastUS_Test" -testSubnetName "EUS-Subnet-2" -testSecurityGroupName "SGP_East_Us_Test" -testInstanceType "Standard_DS1_v2"
```
Creates a VPG with the specified settings returning a Vpg Settings Identifier to the specified variable to be used in later steps creating the Vpg. Only mandatory parameters are specified in this example.
## PARAMETERS
### -JournalHistoryInHours
Desired journal history in hours of the VPG to be created.
Min 1 hour, Max 720 hours (30 days).
Default is 24 hours.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LiveDiskType
Type of disk to select as the default for the VPG during a live operation.
Default is 'ManagedPremiumSSD'
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: UnmanagedStandard, ManagedPremiumSSD, ManagedStandardSSD, ManagedStandardHDD
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LiveInstanceType
Name of the default VM Instance Type to use during a live operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LiveNetworkName
Name of the default Network (VNet) to use during a live operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LiveSecurityGroupName
Name of the default Security Group to use during a live operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LiveSubnetName
Name of the default subnet to use during a live operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Name
Desired name of the VPG to be created.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Priority
Replication priority of the VPG to be created.
Default value is 'Medium'
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: High, Medium, Low
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -RpoInSeconds
Desired RPO alert value in seconds.
Min 60 seconds, Max 86400 seconds (24 hours).
Default is 300 seconds (5 minutes).
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TargetSiteName
Name of the ZCA site for the VPG to target.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TestDiskType
Type of disk to select as the default for the VPG during a live operation.
Default is 'ManagedPremiumSSD'
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: UnmanagedStandard, ManagedPremiumSSD, ManagedStandardSSD, ManagedStandardHDD
Required: False
Position: 16
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TestInstanceType
Name of the default VM Instance Type to use during a test operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 15
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TestIntervalInMinutes
Desired test interval in minutes.
Please review documentation for values.
Default is 262080 minutes (6 months).
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Accepted values: 0, 43200, 131040, 262080, 394560, 525600
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TestNetworkName
Name of the default Network (VNet) to use during a test operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TestSecurityGroupName
Name of the default Security Group to use during a test operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 14
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -TestSubnetName
Name of the default subnet to use during a test operation.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 13
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -UseWanCompression
Turn on or off WAN compression.
Recommended this setting is not turned off.
Default is to leave WAN compression turned on.
```yaml
Type: Boolean
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### System.Object
Vpg Settings Identifier
## NOTES
Please review the process and examples outlined in the [Wiki on GitHub](https://Need.ToAdd.link/To/Wiki) for full Vpg Creation workflow and required examples.
## RELATED LINKS
[Zerto Create Azure VPG Help Documentation](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vsphere_to_azure_vpg_management_apis.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____26)
+1 -1
View File
@@ -1 +1 @@
1.5.0 1.5.1