PS 5.1 support and build pipeline updates
Updated some code for PS 5.1 version support with ZVMa as well as updated the azure-pipelines to build for zvma-updates branch
This commit is contained in:
@@ -5,6 +5,17 @@ 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).
|
||||||
|
|
||||||
|
## [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]
|
## [1.5.4]
|
||||||
|
|
||||||
### Zerto Virtual Manager
|
### Zerto Virtual Manager
|
||||||
|
|||||||
@@ -123,18 +123,26 @@ 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 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") {
|
if ($uri -eq "auth/realms/zerto/protocol/openid-connect/token" -and $method -eq "POST") {
|
||||||
$submittedURI = "https://{0}:{1}/{2}" -f $script:zvmServer, $script:zvmPort, $uri
|
$data = @{
|
||||||
$body = @{
|
|
||||||
'client_id' = $script:zertoClientId
|
'client_id' = $script:zertoClientId
|
||||||
'username' = $credential.GetNetworkCredential().Username
|
'username' = $credential.GetNetworkCredential().UserName
|
||||||
'password' = $credential.GetNetworkCredential().Password
|
'password' = $credential.GetNetworkCredential().Password
|
||||||
'grant_type' = 'password'
|
'grant_type' = 'password'
|
||||||
}
|
}
|
||||||
$contentType = 'application/x-www-form-urlencoded'
|
|
||||||
|
|
||||||
$apiRequestResults = Invoke-WebRequest -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
$params = @{
|
||||||
#$responseHeaders = @{ }
|
'Uri' = 'https://' + $script:zvmServer + ':' + $script:zvmPort + '/auth/realms/zerto/protocol/openid-connect/token'
|
||||||
#$responseHeaders['x-zerto-session'] = @($apiRequestResults.Headers['x-zerto-session'])
|
'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
|
||||||
|
$responseHeaders = @{ }
|
||||||
|
$responseHeaders['Authorization'] = "Bearer " + @($apiRequestResults.access_token)
|
||||||
} elseif ($method -ne "GET") {
|
} elseif ($method -ne "GET") {
|
||||||
# If the Method is something other than 'GET' use this call with a body parameter
|
# 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
|
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||||
|
|||||||
+2
-2
@@ -10,12 +10,12 @@ trigger:
|
|||||||
branches:
|
branches:
|
||||||
include:
|
include:
|
||||||
- master
|
- master
|
||||||
- PowerShellBackPort
|
- zvma-updates
|
||||||
- Refactor-Build
|
|
||||||
|
|
||||||
# Trigger CI on pull requests to master and develop branches
|
# Trigger CI on pull requests to master and develop branches
|
||||||
pr:
|
pr:
|
||||||
- master
|
- master
|
||||||
|
- zvma-updates
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Windows PowerShell 5.1 Build Job
|
# Windows PowerShell 5.1 Build Job
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ Establishes a connection to a ZVM using credentials provided via a PSCredential
|
|||||||
|
|
||||||
### Example 1
|
### Example 1
|
||||||
```powershell
|
```powershell
|
||||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential
|
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "443" -credential $credential
|
||||||
```
|
```
|
||||||
|
|
||||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object.
|
Establishes a connection to ZVM 192.168.1.100 on port 443 with supplied PSCredential object.
|
||||||
|
|
||||||
### Example 2
|
### Example 2
|
||||||
```powershell
|
```powershell
|
||||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential -AutoReconnect
|
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "443" -credential $credential -AutoReconnect
|
||||||
```
|
```
|
||||||
|
|
||||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. Adding the `-AutoReconnect` switch
|
Establishes a connection to ZVM 192.168.1.100 on port 443 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.
|
will cache the PSCredential object should the session need to be reauthorized due to an expired token.
|
||||||
|
|
||||||
## PARAMETERS
|
## PARAMETERS
|
||||||
@@ -86,7 +86,7 @@ Accept wildcard characters: False
|
|||||||
|
|
||||||
### -zertoPort
|
### -zertoPort
|
||||||
Zerto Virtual Manager management port.
|
Zerto Virtual Manager management port.
|
||||||
Default value is 9669.
|
Default value is 443.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
Type: String
|
Type: String
|
||||||
@@ -95,7 +95,7 @@ Aliases: port
|
|||||||
|
|
||||||
Required: False
|
Required: False
|
||||||
Position: Named
|
Position: Named
|
||||||
Default value: "9669"
|
Default value: "443"
|
||||||
Accept pipeline input: False
|
Accept pipeline input: False
|
||||||
Accept wildcard characters: False
|
Accept wildcard characters: False
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user