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/),
|
||||
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]
|
||||
|
||||
### 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 ($uri -eq "auth/realms/zerto/protocol/openid-connect/token" -and $method -eq "POST") {
|
||||
$submittedURI = "https://{0}:{1}/{2}" -f $script:zvmServer, $script:zvmPort, $uri
|
||||
$body = @{
|
||||
$data = @{
|
||||
'client_id' = $script:zertoClientId
|
||||
'username' = $credential.GetNetworkCredential().Username
|
||||
'username' = $credential.GetNetworkCredential().UserName
|
||||
'password' = $credential.GetNetworkCredential().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
|
||||
#$responseHeaders = @{ }
|
||||
#$responseHeaders['x-zerto-session'] = @($apiRequestResults.Headers['x-zerto-session'])
|
||||
$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
|
||||
$responseHeaders = @{ }
|
||||
$responseHeaders['Authorization'] = "Bearer " + @($apiRequestResults.access_token)
|
||||
} 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
|
||||
|
||||
+2
-2
@@ -10,12 +10,12 @@ trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
- PowerShellBackPort
|
||||
- Refactor-Build
|
||||
- zvma-updates
|
||||
|
||||
# Trigger CI on pull requests to master and develop branches
|
||||
pr:
|
||||
- master
|
||||
- zvma-updates
|
||||
|
||||
jobs:
|
||||
# Windows PowerShell 5.1 Build Job
|
||||
|
||||
@@ -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 "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
|
||||
```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.
|
||||
|
||||
## PARAMETERS
|
||||
@@ -86,7 +86,7 @@ Accept wildcard characters: False
|
||||
|
||||
### -zertoPort
|
||||
Zerto Virtual Manager management port.
|
||||
Default value is 9669.
|
||||
Default value is 443.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
@@ -95,7 +95,7 @@ Aliases: port
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: "9669"
|
||||
Default value: "443"
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user