Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e16d4d8105 | |||
| 143d5f801e | |||
| f46c620302 | |||
| 3c60b0c0f3 | |||
| d832812c13 | |||
| 80e0db3883 | |||
| 809f9af60d | |||
| 5a9cba00d5 | |||
| 549238a22d | |||
| 253c9ba1b9 | |||
| 794f87dbf8 | |||
| ca45adcd5d | |||
| 5a3f2d8eec |
+3
-46
@@ -5,56 +5,13 @@ 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/),
|
||||
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.1.0]
|
||||
|
||||
### Added
|
||||
|
||||
* Added Support for Zerto 10.7u1 Virtual Appliance - You can now authenticate to Zerto Virtual Appliances and run the other functions of this module.
|
||||
|
||||
### Updated
|
||||
|
||||
* Updated `Invoke-ZertoRestRequest` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md)
|
||||
|
||||
## [2.0.0]
|
||||
|
||||
### Added
|
||||
|
||||
* Added Support for Zerto 10 Virtual Appliance - You can now authenticate to Zerto Virtual Appliances and run the other functions of this module.
|
||||
|
||||
### Updated
|
||||
|
||||
* Updated `Connect-ZertoServer` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md)
|
||||
* Updated `Invoke-ZertoRestRequest` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md)
|
||||
|
||||
## [1.5.4]
|
||||
## Unreleased
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Updated
|
||||
|
||||
* Updated `Install-ZertoVra` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) to allow for configuring the number of vCPUs during deployment. Special thanks to @mitchellen for the fix.
|
||||
|
||||
## [1.5.3]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/112) where `New-ZertoVpg` would fail when specifying the local site as the target site.
|
||||
* Updated the method where a Site Identifer is obtained during the `New-ZertoVpg` execution that would occasionally fail on some versions of PowerShell.
|
||||
|
||||
#### Updated
|
||||
|
||||
* Updated `New-ZertoVpg` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md) to more clearly specify the return value and the requirement to pass it into the `Save-ZertoVpgSetting` function to commit the VPG.
|
||||
|
||||
## [1.5.2]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an issue when attempting to export more than 100 VPGs with the `Export-ZertoVpg` function that would cause an error.
|
||||
#### 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
|
||||
|
||||
@@ -21,7 +21,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
It "port variable has a non-mandatory String parameter" {
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -Not -Mandatory
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -Type String
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -DefaultValue "443"
|
||||
Get-Command $global:function | Should -HaveParameter zertoPort -DefaultValue "9669"
|
||||
}
|
||||
|
||||
It "port variable does not accecpt an empty or null input" {
|
||||
@@ -46,10 +46,10 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
{ Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString' }) } | Should -Throw
|
||||
}
|
||||
|
||||
#It "has a switch parameter to return the headers" {
|
||||
# #Get-Command $global:function | Should -HaveParameter returnHeaders
|
||||
# Get-Command $global:function | Should -HaveParameter returnHeaders -Type Switch
|
||||
#}
|
||||
It "has a switch parameter to return the headers" {
|
||||
Get-Command $global:function | Should -HaveParameter returnHeaders
|
||||
Get-Command $global:function | Should -HaveParameter returnHeaders -Type Switch
|
||||
}
|
||||
|
||||
It "has a switch parameter to auto reauthorize the session" {
|
||||
Get-Command $global:function | Should -HaveParameter autoReconnect
|
||||
@@ -73,7 +73,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
$server = '192.168.1.100'
|
||||
$password = ConvertTo-SecureString -String "NotARealPassword" -AsPlainText -Force
|
||||
$credential = New-Object pscredential('NotARealUser', $password)
|
||||
#$now = $(Get-Date).ticks
|
||||
$now = $(Get-Date).ticks
|
||||
Connect-ZertoServer -zertoServer $server -credential $credential
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
It "Module Scope zvmPort variable tests" {
|
||||
$script:zvmPort | Should -Not -BeNullOrEmpty
|
||||
$script:zvmPort | Should -Be '443'
|
||||
$script:zvmPort | Should -Be '9669'
|
||||
}
|
||||
|
||||
It "Module Scope zvmLastAction variable tests" {
|
||||
@@ -92,38 +92,38 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
$script:zvmLastAction | Should -BeGreaterOrEqual $now
|
||||
}
|
||||
|
||||
#It "Module Scope zvmHeaders variable tests" {
|
||||
# $script:zvmHeaders | Should -Not -BeNullOrEmpty
|
||||
# $script:zvmHeaders | Should -BeOfType PSCustomObject
|
||||
# $script:zvmHeaders.keys.count | Should -BeExactly 3
|
||||
#$script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue
|
||||
# $script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue
|
||||
#$script:zvmHeaders['x-zerto-session'] | Should -BeOfType String
|
||||
# $script:zvmHeaders['Accept'] | Should -BeOfType String
|
||||
#}
|
||||
It "Module Scope zvmHeaders variable tests" {
|
||||
$script:zvmHeaders | Should -Not -BeNullOrEmpty
|
||||
$script:zvmHeaders | Should -BeOfType PSCustomObject
|
||||
$script:zvmHeaders.keys.count | Should -BeExactly 3
|
||||
$script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue
|
||||
$script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue
|
||||
$script:zvmHeaders['x-zerto-session'] | Should -BeOfType String
|
||||
$script:zvmHeaders['Accept'] | Should -BeOfType String
|
||||
}
|
||||
|
||||
#$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
|
||||
#It "returns a Hashtable with 2 keys" {
|
||||
# $headers | Should -BeOfType Hashtable
|
||||
# $headers.keys.count | Should -Be 3
|
||||
#}
|
||||
$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
|
||||
It "returns a Hashtable with 2 keys" {
|
||||
$headers | Should -BeOfType Hashtable
|
||||
$headers.keys.count | Should -Be 3
|
||||
}
|
||||
|
||||
#It "return value has a key called 'x-zerto-session'" {
|
||||
# $headers.ContainsKey('x-zerto-session') | Should -Be $true
|
||||
#}
|
||||
It "return value has a key called 'x-zerto-session'" {
|
||||
$headers.ContainsKey('x-zerto-session') | Should -Be $true
|
||||
}
|
||||
|
||||
#It "return key 'x-zerto-session' value should be a string" {
|
||||
# $headers['x-zerto-session'] | Should -BeOfType "String"
|
||||
# $headers['x-zerto-session'] | Should -BeExactly "e34da0b0-4bc2-4cda-b316-0384e35bdca5"
|
||||
#}
|
||||
It "return key 'x-zerto-session' value should be a string" {
|
||||
$headers['x-zerto-session'] | Should -BeOfType "String"
|
||||
$headers['x-zerto-session'] | Should -BeExactly "e34da0b0-4bc2-4cda-b316-0384e35bdca5"
|
||||
}
|
||||
|
||||
It "return value has a key called 'accept'" {
|
||||
$headers.ContainsKey('accept') | Should -Be $true
|
||||
}
|
||||
|
||||
#It "return key 'accept' value should be 'application/json'" {
|
||||
# $headers['accept'] | Should -Be 'application/json'
|
||||
#}
|
||||
It "return key 'accept' value should be 'application/json'" {
|
||||
$headers['accept'] | Should -Be 'application/json'
|
||||
}
|
||||
|
||||
It "should not require a port to be specified" {
|
||||
Connect-ZertoServer -zertoServer $Server -credential $credential
|
||||
|
||||
@@ -46,10 +46,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
return "1024d377-afb8-4880-82f0-96eeff413ffd"
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Remove-ZertoVpgSettingsIdentifier {
|
||||
return $null
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpgSetting {
|
||||
$returnObj = @{
|
||||
Backup = $null
|
||||
|
||||
@@ -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
|
||||
@@ -6,7 +6,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 24 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 25
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 24
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
},
|
||||
"LastTest": null,
|
||||
"Link": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": null,
|
||||
"type": "VmApi"
|
||||
},
|
||||
"Link_{0}": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": "self",
|
||||
"type": "VmApi"
|
||||
},
|
||||
@@ -38,7 +38,7 @@
|
||||
"OutgoingBandWidthInMbps": 0.001953125,
|
||||
"Priority": 1,
|
||||
"ProtectedSite": {
|
||||
"href": "https://192.168.10.20/v1/localsite",
|
||||
"href": "https://192.168.10.20:9669/v1/localsite",
|
||||
"identifier": "9e09efa0-0d00-46ed-929b-f86273b28205",
|
||||
"rel": null,
|
||||
"type": "LocalSiteApi"
|
||||
@@ -46,7 +46,7 @@
|
||||
"ProvisionedStorageInMB": 77906,
|
||||
"RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15",
|
||||
"RecoverySite": {
|
||||
"href": "https://192.168.10.20/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"identifier": "057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"rel": null,
|
||||
"type": "PeerSiteApi"
|
||||
@@ -92,13 +92,13 @@
|
||||
},
|
||||
"LastTest": null,
|
||||
"Link": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": null,
|
||||
"type": "VmApi"
|
||||
},
|
||||
"Link_{0}": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": "self",
|
||||
"type": "VmApi"
|
||||
},
|
||||
@@ -106,7 +106,7 @@
|
||||
"OutgoingBandWidthInMbps": 0.0009765625,
|
||||
"Priority": 1,
|
||||
"ProtectedSite": {
|
||||
"href": "https://192.168.10.20/v1/localsite",
|
||||
"href": "https://192.168.10.20:9669/v1/localsite",
|
||||
"identifier": "9e09efa0-0d00-46ed-929b-f86273b28205",
|
||||
"rel": null,
|
||||
"type": "LocalSiteApi"
|
||||
@@ -114,7 +114,7 @@
|
||||
"ProvisionedStorageInMB": 77906,
|
||||
"RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15",
|
||||
"RecoverySite": {
|
||||
"href": "https://192.168.10.20/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"identifier": "057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"rel": null,
|
||||
"type": "PeerSiteApi"
|
||||
@@ -160,13 +160,13 @@
|
||||
},
|
||||
"LastTest": null,
|
||||
"Link": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": null,
|
||||
"type": "VmApi"
|
||||
},
|
||||
"Link_{0}": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": "self",
|
||||
"type": "VmApi"
|
||||
},
|
||||
@@ -174,7 +174,7 @@
|
||||
"OutgoingBandWidthInMbps": 0.00146484375,
|
||||
"Priority": 1,
|
||||
"ProtectedSite": {
|
||||
"href": "https://192.168.10.20/v1/localsite",
|
||||
"href": "https://192.168.10.20:9669/v1/localsite",
|
||||
"identifier": "9e09efa0-0d00-46ed-929b-f86273b28205",
|
||||
"rel": null,
|
||||
"type": "LocalSiteApi"
|
||||
@@ -182,7 +182,7 @@
|
||||
"ProvisionedStorageInMB": 77906,
|
||||
"RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15",
|
||||
"RecoverySite": {
|
||||
"href": "https://192.168.10.20/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"identifier": "057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"rel": null,
|
||||
"type": "PeerSiteApi"
|
||||
@@ -228,13 +228,13 @@
|
||||
},
|
||||
"LastTest": null,
|
||||
"Link": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": null,
|
||||
"type": "VmApi"
|
||||
},
|
||||
"Link_{0}": {
|
||||
"href": "https://192.168.10.20/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd",
|
||||
"rel": "self",
|
||||
"type": "VmApi"
|
||||
},
|
||||
@@ -242,7 +242,7 @@
|
||||
"OutgoingBandWidthInMbps": 0.01953125,
|
||||
"Priority": 1,
|
||||
"ProtectedSite": {
|
||||
"href": "https://192.168.10.20/v1/localsite",
|
||||
"href": "https://192.168.10.20:9669/v1/localsite",
|
||||
"identifier": "9e09efa0-0d00-46ed-929b-f86273b28205",
|
||||
"rel": null,
|
||||
"type": "LocalSiteApi"
|
||||
@@ -250,7 +250,7 @@
|
||||
"ProvisionedStorageInMB": 102400,
|
||||
"RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15",
|
||||
"RecoverySite": {
|
||||
"href": "https://192.168.10.20/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"identifier": "057cab27-f02a-443a-989d-7f14341fa9c3",
|
||||
"rel": null,
|
||||
"type": "PeerSiteApi"
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
"IOPs": 8,
|
||||
"LastTest": "2019-07-11T16:51:07.022Z",
|
||||
"Link": {
|
||||
"href": "https://192.168.222.1/v1/vpgs/99c460c1-a4ec-48dd-8921-bbcca9cd29b9",
|
||||
"href": "https://192.168.222.1:7669/v1/vpgs/99c460c1-a4ec-48dd-8921-bbcca9cd29b9",
|
||||
"identifier": "99c460c1-a4ec-48dd-8921-bbcca9cd29b9",
|
||||
"rel": null,
|
||||
"type": "VpgApi"
|
||||
},
|
||||
"Link_{0}": {
|
||||
"href": "https://192.168.222.1/v1/vpgs/99c460c1-a4ec-48dd-8921-bbcca9cd29b9",
|
||||
"href": "https://192.168.222.1:7669/v1/vpgs/99c460c1-a4ec-48dd-8921-bbcca9cd29b9",
|
||||
"rel": "self",
|
||||
"type": "VpgApi"
|
||||
},
|
||||
@@ -42,14 +42,14 @@
|
||||
"Priority": 1,
|
||||
"ProgressPercentage": 0,
|
||||
"ProtectedSite": {
|
||||
"href": "https://192.168.222.1/v1/localsite",
|
||||
"href": "https://192.168.222.1:7669/v1/localsite",
|
||||
"identifier": "63a62dc2-ef6f-45aa-809f-9dbaeb8c06cf",
|
||||
"rel": null,
|
||||
"type": "LocalSiteApi"
|
||||
},
|
||||
"ProvisionedStorageInMB": 400,
|
||||
"RecoverySite": {
|
||||
"href": "https://192.168.222.1/v1/peersites/3e4cdd0d-1064-4022-921f-6265ad6d335a",
|
||||
"href": "https://192.168.222.1:7669/v1/peersites/3e4cdd0d-1064-4022-921f-6265ad6d335a",
|
||||
"identifier": "3e4cdd0d-1064-4022-921f-6265ad6d335a",
|
||||
"rel": null,
|
||||
"type": "PeerSiteApi"
|
||||
@@ -67,7 +67,7 @@
|
||||
"VpgIdentifier": "99c460c1-a4ec-48dd-8921-bbcca9cd29b9",
|
||||
"VpgName": "Exchange",
|
||||
"Zorg": {
|
||||
"href": "https://192.168.222.1/v1/zorgs/00000000-0000-0000-0000-000000000000",
|
||||
"href": "https://192.168.222.1:7669/v1/zorgs/00000000-0000-0000-0000-000000000000",
|
||||
"identifier": "00000000-0000-0000-0000-000000000000",
|
||||
"rel": null,
|
||||
"type": "ZorgApi"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
SkipPublisherCheck = $true
|
||||
}
|
||||
Target = 'CurrentUser'
|
||||
Version = '1.21.0'
|
||||
Version = '1.19.0'
|
||||
Tags = 'Bootstrap'
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -52,7 +52,7 @@ task CheckPSScriptAnalyzerInstalled {
|
||||
task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, {
|
||||
$scriptAnalyzerParams = @{
|
||||
Path = "$BuildRoot\ZertoApiWrapper\"
|
||||
Severity = @('Error') #, 'Warning')
|
||||
Severity = @('Error', 'Warning')
|
||||
Recurse = $true
|
||||
Verbose = $false
|
||||
ExcludeRule = @('PSUseToExportFieldsInManifest', 'PSUseBOMForUnicodeEncodedFile', 'PSUseSingularNouns', 'PSReviewUnusedParameter')
|
||||
@@ -67,7 +67,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, {
|
||||
task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
|
||||
$scriptAnalyzerParams = @{
|
||||
Path = $moduleOutPath
|
||||
Severity = @('Error') #, 'Warning')
|
||||
Severity = @('Error', 'Warning')
|
||||
Recurse = $true
|
||||
Verbose = $false
|
||||
ExcludeRule = @('PSUseSingularNouns', 'PSUseBOMForUnicodeEncodedFile', 'PSReviewUnusedParameter')
|
||||
@@ -93,21 +93,21 @@ task CleanPublish {
|
||||
#EndRegion
|
||||
|
||||
#Region - Pester Tests
|
||||
#task SourceFileTests CheckPesterInstalled, {
|
||||
# ImportSourceModule
|
||||
# $testResultsFile = "$BuildRoot\Tests\SourceTestResults.xml"
|
||||
# $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails
|
||||
# $FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount
|
||||
# Assert ($results.FailedCount -eq 0) $FailureMessage
|
||||
#}
|
||||
task SourceFileTests CheckPesterInstalled, {
|
||||
ImportSourceModule
|
||||
$testResultsFile = "$BuildRoot\Tests\SourceTestResults.xml"
|
||||
$script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails
|
||||
$FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount
|
||||
Assert ($results.FailedCount -eq 0) $FailureMessage
|
||||
}
|
||||
|
||||
#task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
|
||||
# ImportBuiltModule
|
||||
# $testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml"
|
||||
# $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Failed
|
||||
# $FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount
|
||||
# Assert ($results.FailedCount -eq 0) $FailureMessage
|
||||
#}
|
||||
task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
|
||||
ImportBuiltModule
|
||||
$testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml"
|
||||
$script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Failed
|
||||
$FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount
|
||||
Assert ($results.FailedCount -eq 0) $FailureMessage
|
||||
}
|
||||
#EndRegion
|
||||
|
||||
#Region - Build Help System
|
||||
@@ -182,8 +182,8 @@ task CreatePsm1ForRelease CreatePsd1ForRelease, {
|
||||
#EndRegion
|
||||
|
||||
#Region - Artifacts \ Publish
|
||||
# Full Build Process - No Publishing add this later \/ BuiltFileTests,
|
||||
task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuildMamlHelp, {
|
||||
# Full Build Process - No Publishing
|
||||
task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
|
||||
Compress-Archive -Path $moduleOutPath -DestinationPath .\publish\ZertoApiWrapper.zip
|
||||
$MyMatches = Select-String -Path "$BuildRoot\CHANGELOG.md" "^##\s\["
|
||||
$data = Get-Content "$BuildRoot\CHANGELOG.md"
|
||||
@@ -193,8 +193,8 @@ task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuildMamlHelp, {
|
||||
}
|
||||
}
|
||||
#EndRegion
|
||||
# addd back to line below between analyze and create BuiltFileTests,
|
||||
task build CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, CreateArtifacts
|
||||
|
||||
task build CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts
|
||||
task quickBuild CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, {
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
ImportBuiltModule
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ function Add-ZertoPeerSite {
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$targetHost,
|
||||
[Parameter(
|
||||
HelpMessage = "Target communication port. Default is 9071 for Zerto 10.0 and Later. For ZVR 9.7 and earlier, use port 9081."
|
||||
HelpMessage = "Target communication port. Default is 9081"
|
||||
)]
|
||||
[ValidateRange(1024, 65535)]
|
||||
[int]$targetPort = 9071,
|
||||
[int]$targetPort = 9081,
|
||||
[Parameter(
|
||||
HelpMessage = "The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 10.0 and later."
|
||||
HelpMessage = "The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 7.5 and later."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$token
|
||||
|
||||
@@ -18,35 +18,29 @@ function Connect-ZertoServer {
|
||||
)]
|
||||
[System.Management.Automation.PSCredential]$credential,
|
||||
[Parameter(
|
||||
HelpMessage = "Zerto Virtual Manager management port. Default value is 443."
|
||||
HelpMessage = "Zerto Virtual Manager management port. Default value is 9669."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ValidateRange(443, 65535)]
|
||||
[ValidateRange(1024, 65535)]
|
||||
[Alias("port")]
|
||||
[string]$zertoPort = "443",
|
||||
[Parameter(
|
||||
HelpMessage = "Zerto Keycloak client id. Default value is zerto-client."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("clientid")]
|
||||
[string]$zertoClientId = "zerto-client",
|
||||
[string]$zertoPort = "9669",
|
||||
[Parameter(
|
||||
HelpMessage = "Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused"
|
||||
)]
|
||||
[switch]$AutoReconnect,
|
||||
[Parameter(
|
||||
HelpMessage = "Use this switch to return the Bearer Token to a specified variable or to the default output."
|
||||
HelpMessage = "Use this switch to return the headers to a specified variable or to the default output."
|
||||
)]
|
||||
[switch]$returnToken
|
||||
[switch]$returnHeaders
|
||||
|
||||
)
|
||||
|
||||
begin {
|
||||
$uri = "auth/realms/zerto/protocol/openid-connect/token"
|
||||
$body = '{"AuthenticationMethod": "1"}'
|
||||
$uri = "session/add"
|
||||
# Set Script Scope Variables for Use in all functions in the module; Server and Port Information
|
||||
Set-Variable -Name zvmServer -Scope Script -Value $zertoServer
|
||||
Set-Variable -Name zvmPort -Scope Script -Value $zertoPort
|
||||
Set-Variable -Name zvmClientId -Scope Script -Value $zertoClientId
|
||||
# Set zvmLastAction Variable to keep track when the API token expires
|
||||
Set-Variable -Name zvmLastAction -Scope Script -Value $(Get-Date).Ticks
|
||||
# Set / Clear the zvmHeaders to clear any existing token
|
||||
@@ -58,21 +52,19 @@ function Connect-ZertoServer {
|
||||
if ($Script:Reconnect) {
|
||||
Set-Variable -Name CachedCredential -Scope Script -Value $credential
|
||||
}
|
||||
# need to check to see if we need this or if the zvmclientid above is enough
|
||||
Set-Variable -Name zertoClientId -Scope Script -Value $zertoClientId
|
||||
}
|
||||
|
||||
process {
|
||||
# Send authorization request to the function and send back the results including headers -returnHeaders
|
||||
$results = Invoke-ZertoRestRequest -uri $uri -credential $credential -method POST -ErrorAction Stop
|
||||
# Send authorization request to the function and send back the results including headers
|
||||
$results = Invoke-ZertoRestRequest -uri $uri -credential $credential -returnHeaders -body $body -method POST -ErrorAction Stop
|
||||
}
|
||||
|
||||
end {
|
||||
# Build Headers Hashtable with Authorization Token
|
||||
$script:zvmHeaders['Authorization'] = "Bearer " + $results.access_token.ToString()
|
||||
|
||||
$Script:zvmHeaders['x-zerto-session'] = $results.Headers['x-zerto-session'][0].ToString()
|
||||
|
||||
# Have the option to return the headers to a variable
|
||||
if ($returnToken) {
|
||||
if ($returnHeaders) {
|
||||
return $Script:zvmHeaders
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
function Disconnect-ZertoServer {
|
||||
[cmdletbinding()]
|
||||
param()
|
||||
$uri = "auth/realms/zerto/protocol/openid-connect/logout"
|
||||
$uri = "session"
|
||||
|
||||
# Delete API Authorization
|
||||
$null = Invoke-ZertoRestRequest -uri $uri -method POST
|
||||
$null = Invoke-ZertoRestRequest -uri $uri -method DELETE
|
||||
|
||||
# Remove all variables used
|
||||
Remove-Variable -Name zvmServer -Scope Script
|
||||
|
||||
@@ -38,7 +38,6 @@ function Export-ZertoVpg {
|
||||
$vpgSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
$filePath = "{0}\{1}.json" -f $outputPath, $name
|
||||
$vpgSettings | Convertto-Json -depth 10 | Out-File -FilePath $filePath
|
||||
$null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,6 @@ function Import-ZertoVmNicSetting {
|
||||
$NicUri = "{0}/nics/{1}" -f $uri, $nic.NicIdentifier
|
||||
Invoke-ZertoRestRequest -uri $NicUri -Method "DELETE" > $null
|
||||
$nicSettings = Invoke-ZertoRestRequest -uri $NicUri -Method "GET"
|
||||
$nicSettings.failover.Hypervisor.ShouldReplaceIpConfiguration = "True"
|
||||
$nicSettings.failover.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.LiveNetwork]
|
||||
$nicSettings.failover.Hypervisor.ShouldReplaceMacAddress = $vm.LiveShouldReplaceMac
|
||||
if ($vm.LiveIsDHCP -imatch "true") {
|
||||
@@ -78,7 +77,6 @@ function Import-ZertoVmNicSetting {
|
||||
$nicSettings.failover.Hypervisor.IpConfig = $IpConfig
|
||||
$nicSettings.failover.Hypervisor.DnsSuffix = $vm.LiveDnsSuffix
|
||||
}
|
||||
$nicSettings.failoverTest.Hypervisor.ShouldReplaceIpConfiguration = "True"
|
||||
$nicSettings.failoverTest.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.TestNetwork]
|
||||
$nicSettings.failoverTest.Hypervisor.ShouldReplaceMacAddress = $vm.TestShouldReplaceMac
|
||||
if ($vm.TestIsDHCP -imatch "true" ) {
|
||||
|
||||
@@ -25,11 +25,6 @@ function Install-ZertoVra {
|
||||
)]
|
||||
[ValidateRange(1, 16)]
|
||||
[int]$memoryInGB = 3,
|
||||
[Parameter(
|
||||
HelpMessage = "Initial number of CPUs to assign to the VRA. Default is 1, Minimum is 1, Maximum is 4"
|
||||
)]
|
||||
[ValidateRange(1, 4)]
|
||||
[int]$NumOfCpus = 1,
|
||||
[Parameter(
|
||||
HelpMessage = "Bandwidth group to assign to the VRA. If unspecified will assign to the 'default_group'"
|
||||
)]
|
||||
@@ -141,7 +136,6 @@ function Install-ZertoVra {
|
||||
}
|
||||
$vraBasic['HostIdentifier'] = $hostIdentifier.toString()
|
||||
$vraBasic['MemoryInGB'] = $memoryInGB
|
||||
$vraBasic['NumOfCpus'] = $NumOfCpus
|
||||
$vraBasic['NetworkIdentifier'] = $networkIdentifier.toString()
|
||||
$vraBasic['UsePublicKeyInsteadOfCredentials'] = $true
|
||||
$vraBasicNetwork = [ordered]@{ }
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<#
|
||||
.ExternalHelp ./en-us/ZertoApiWrapper-help.xml
|
||||
#>
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Invoke-ZertoRestRequest {
|
||||
[cmdletbinding()]
|
||||
param(
|
||||
@@ -43,15 +41,12 @@ function Invoke-ZertoRestRequest {
|
||||
}
|
||||
|
||||
# If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired
|
||||
if ( (Test-Path variable:script:zvmHeaders) -and (Test-Path variable:script:AuthExpiresAt) -and $([datetime]$script:AuthExpiresAt) -lt $(Get-Date) -and $Script:Reconnect -eq $False ) {
|
||||
Remove-Variable -Name AuthExpiresAt -Scope Script
|
||||
if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $False ) {
|
||||
Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager"
|
||||
} elseif (( (Test-Path variable:script:zvmHeaders) -and (Test-Path variable:script:AuthExpiresAt) -and $([datetime]$script:AuthExpiresAt) -lt $(Get-Date) -and $Script:Reconnect -eq $True )) {
|
||||
} elseif (( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $True )) {
|
||||
Write-Verbose "Authorization had expired. Attempting Reauthorization."
|
||||
Remove-Variable -Name AuthExpiresAt -Scope Script
|
||||
Connect-ZertoServer -zertoServer $Script:zvmServer -zertoPort $script:zvmPort -credential $Script:CachedCredential
|
||||
}# else {
|
||||
|
||||
# Build the URI to be submitted
|
||||
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
|
||||
try {
|
||||
@@ -59,49 +54,7 @@ function Invoke-ZertoRestRequest {
|
||||
$script:zvmLastAction = (Get-Date).Ticks
|
||||
# If running PwSh - Use this Invoke-RestMethod with passed Variables
|
||||
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||
# If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers and Body as expected.
|
||||
if ($uri -eq "auth/realms/zerto/protocol/openid-connect/token" -and $method -eq "POST") {
|
||||
$data = @{
|
||||
'client_id' = $script:zertoClientId
|
||||
'username' = $credential.GetNetworkCredential().UserName
|
||||
'password' = $credential.GetNetworkCredential().Password
|
||||
'grant_type' = 'password'
|
||||
'scope' = 'openid'
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/token'
|
||||
'Method' = 'Post'
|
||||
'Body' = $data
|
||||
'ContentType' = 'application/x-www-form-urlencoded'
|
||||
}
|
||||
$apiRequestResults = Invoke-RestMethod @params -SkipCertificateCheck
|
||||
|
||||
$ExpiresIn = $apiRequestResults.expires_in
|
||||
$script:AuthExpiresAt = (Get-Date).AddSeconds($ExpiresIn)
|
||||
$script:refreshToken = $apiRequestResults.refresh_token
|
||||
$responseHeaders = @{ }
|
||||
$responseHeaders['Authorization'] = "Bearer " + @($apiRequestResults.access_token)
|
||||
|
||||
# If we are logging out from the ZVM, use this block to use Invoke-WebRequest and format the Headers and Body as expected.
|
||||
} elseif ($uri -eq "auth/realms/zerto/protocol/openid-connect/logout" -and $method -eq "POST") {
|
||||
$data = @{
|
||||
'client_id' = $script:zertoClientId
|
||||
'logout' = 'true'
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/logout'
|
||||
'Method' = 'Post'
|
||||
'Body' = $data
|
||||
'ContentType' = 'application/x-www-form-urlencoded'
|
||||
}
|
||||
|
||||
$apiRequestResults = Invoke-RestMethod @params -SkipCertificateCheck
|
||||
|
||||
} else {
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100
|
||||
}
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100
|
||||
} else {
|
||||
# If running PowerShell 5.1 --> Do the Following
|
||||
# Check to see if All Certs are Trusted. If not, Create the Policy to Trust All Certificates
|
||||
@@ -126,27 +79,10 @@ public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
|
||||
}
|
||||
# If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers as expected.
|
||||
if ($uri -eq "auth/realms/zerto/protocol/openid-connect/token" -and $method -eq "POST") {
|
||||
$data = @{
|
||||
'client_id' = $script:zertoClientId
|
||||
'username' = $credential.GetNetworkCredential().UserName
|
||||
'password' = $credential.GetNetworkCredential().Password
|
||||
'grant_type' = 'password'
|
||||
}
|
||||
|
||||
$params = @{
|
||||
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/token'
|
||||
'Method' = 'POST'
|
||||
'Body' = $data
|
||||
'ContentType' = 'application/x-www-form-urlencoded'
|
||||
}
|
||||
$apiRequestResults = Invoke-RestMethod @params
|
||||
|
||||
$ExpiresIn = $apiRequestResults.expires_in
|
||||
$script:AuthExpiresAt = (Get-Date).AddSeconds($ExpiresIn)
|
||||
$script:refreshToken = $apiRequestResults.refresh_token
|
||||
if ($uri -eq "session/add" -and $method -eq "POST") {
|
||||
$apiRequestResults = Invoke-WebRequest -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
$responseHeaders = @{ }
|
||||
$responseHeaders['Authorization'] = "Bearer " + @($apiRequestResults.access_token)
|
||||
$responseHeaders['x-zerto-session'] = @($apiRequestResults.Headers['x-zerto-session'])
|
||||
} elseif ($method -ne "GET") {
|
||||
# If the Method is something other than 'GET' use this call with a body parameter
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ function New-ZertoVpg {
|
||||
begin {
|
||||
# Create an identifiers table, and start converting names to identifiers.
|
||||
$identifiersTable = @{ }
|
||||
$identifiersTable['recoverySiteIdentifier'] = Get-ZertoVirtualizationSite | Where-Object { $_.VirtualizationSiteName -like $recoverySite } | Select-Object -ExpandProperty SiteIdentifier
|
||||
$identifiersTable['recoverySiteIdentifier'] = (Get-ZertoPeerSite).Where({$_.PeerSiteName -like $recoverySite}) | Select-Object -ExpandProperty SiteIdentifier
|
||||
$peerSiteNetworks = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -networks)
|
||||
$identifiersTable['failoverNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $recoveryNetwork } | Select-Object -ExpandProperty NetworkIdentifier
|
||||
$identifiersTable['testNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $testNetwork } | Select-Object -ExpandProperty NetworkIdentifier
|
||||
|
||||
@@ -30,7 +30,7 @@ function Remove-ZertoVpgVm {
|
||||
}
|
||||
$VmIdentifiers = foreach ($machine in ($vm | Select-Object -Unique)) {
|
||||
if ($machine -in $protectedVms.VmName) {
|
||||
$protectedVms | Where-Object ( { $_.VmName -like $machine }) | Select-Object -ExpandProperty VmIdentifier
|
||||
$protectedVms.Where( { $_.VmName -like $machine }) | Select-Object -ExpandProperty VmIdentifier
|
||||
} else {
|
||||
Write-Warning "Virtual Machine: '$machine' is not found in Vpg: '$VpgName'. Check your parameters. Skipping $machine"
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
RootModule = '.\ZertoApiWrapper.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '2.1.0'
|
||||
ModuleVersion = '0.0.1'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
||||
+2
-33
@@ -10,12 +10,12 @@ trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- zvma-updates
|
||||
- PowerShellBackPort
|
||||
- Refactor-Build
|
||||
|
||||
# Trigger CI on pull requests to master and develop branches
|
||||
pr:
|
||||
- master
|
||||
- zvma-updates
|
||||
|
||||
jobs:
|
||||
# Windows PowerShell 5.1 Build Job
|
||||
@@ -57,12 +57,6 @@ jobs:
|
||||
testRunTitle: "PSCore_Win2016_Built"
|
||||
displayName: "Publish Test Results"
|
||||
condition: always()
|
||||
# Publish module as an artifact
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: "publish/ZertoApiWrapper"
|
||||
ArtifactName: "ZertoApiWrapper"
|
||||
publishLocation: "Container"
|
||||
|
||||
# Linux Build Job
|
||||
- job: Build_PSCore_Ubuntu
|
||||
@@ -109,28 +103,3 @@ jobs:
|
||||
testRunTitle: "PSCore_MacOS1013_Built"
|
||||
displayName: "Publish Test Results"
|
||||
condition: always()
|
||||
|
||||
# Publish Module to Gallery
|
||||
- job: Publish
|
||||
dependsOn:
|
||||
- Build_PS_Windows
|
||||
- Build_PSCore_Windows
|
||||
- Build_PSCore_Ubuntu
|
||||
- Build_PSCore_MacOS
|
||||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/zvma-updates'))
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
steps:
|
||||
# Download the artifact
|
||||
- task: DownloadBuildArtifacts@0
|
||||
inputs:
|
||||
artifactName: 'ZertoApiWrapper' # The name of the artifact you specified in the build job
|
||||
downloadPath: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
# Publish the module to the PowerShell Gallery
|
||||
- powershell: |
|
||||
Install-Module -Name PowerShellGet -Force -Scope CurrentUser
|
||||
$env:PSModulePath = "$(Build.ArtifactStagingDirectory);"+$env:PSModulePath
|
||||
$apiKey = "$(PowerShellGalleryApiKey)"
|
||||
Publish-Module -Path "$(Build.ArtifactStagingDirectory)\ZertoApiWrapper" -NuGetApiKey $apiKey
|
||||
displayName: 'Publish to PowerShell Gallery'
|
||||
|
||||
@@ -24,17 +24,17 @@ Establishes a connection to a ZVM using credentials provided via a PSCredential
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "443" -credential $credential
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential
|
||||
```
|
||||
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 443 with supplied PSCredential object.
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object.
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "443" -credential $credential -AutoReconnect
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential -AutoReconnect
|
||||
```
|
||||
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 443 with supplied PSCredential object. Adding the `-AutoReconnect` switch
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. Adding the `-AutoReconnect` switch
|
||||
will cache the PSCredential object should the session need to be reauthorized due to an expired token.
|
||||
|
||||
## PARAMETERS
|
||||
@@ -86,7 +86,7 @@ Accept wildcard characters: False
|
||||
|
||||
### -zertoPort
|
||||
Zerto Virtual Manager management port.
|
||||
Default value is 443.
|
||||
Default value is 9669.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
@@ -95,7 +95,7 @@ Aliases: port
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: "443"
|
||||
Default value: "9669"
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
@@ -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)
|
||||
@@ -165,22 +165,6 @@ Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -numofCPU
|
||||
Initial number of vCPUs to assign to the VRA.
|
||||
Default is 1, Minimum is 1, Maximum is 4
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -memoryInGB
|
||||
Initial amount of memory to assign to the VRA in GB.
|
||||
Default is 3, Minimum is 1, Maximum is 16
|
||||
|
||||
@@ -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)
|
||||
@@ -8,7 +8,7 @@ schema: 2.0.0
|
||||
# New-ZertoVpg
|
||||
|
||||
## SYNOPSIS
|
||||
Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions. Returns a VpgSettingsIdentifier to be passed into the `Save-ZertoVpgSetting` function to create the VPG.
|
||||
Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2.1.0
|
||||
1.5.1
|
||||
|
||||
Reference in New Issue
Block a user