Automating ZVR with PowerShell and REST APIs …
Automating Zerto
with PowerShell and
REST APIs
Version 2.0
April 2024
Legal Disclaimer
Copyright ? 2024, Zerto Ltd. All rights reserved. Information in this document is confidential and subject to change without
notice and does not represent a commitment on the part of Zerto Ltd. Zerto Ltd. does not assume responsibility for any printing
errors that may appear in this document. No part of this document may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording, or information storage and retrieval systems, for any
purpose other than the purchaser's personal use, without the prior written permission of Zerto Ltd. All other marks and names
mentioned herein may be trademarks of their respective companies. The scripts are provided by example only and are not
supported under any Zerto support program or service. All examples and scripts are provided "as-is" without warranty of any
kind. This includes encrypting passwords. In all the examples provided in this document the passwords are stored using plain
text within your PowerShell scripts. This is often against company policy and is only done so for ease of testing. There are
multiple ways to remove the use of plain text passwords. The author and Zerto further disclaim all implied warranties
including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. In no event shall
Zerto, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages
whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business
information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if the
author or Zerto been advised of the possibility of such damages. The entire risk arising out of the use or performance of the
sample scripts and documentation remains with you.
Automating Zerto with PowerShell and REST APIs
1 of 28
Table of Contents
Legal Disclaimer ..........................................................................................................................................1
Introduction ................................................................................................................................................3
What Are REST APIs? .................................................................................................................................. 3
API Documentation .................................................................................................................................... 3
About the Zerto Virtual Manager Appliance (ZVMA) ..................................................................................4
Creating Keycloak Credentials ...................................................................................................................4
Step 1: Log in to Keycloak ........................................................................................................................... 4
Step 2: Create a New Client ......................................................................................................................... 6
Step 3: Gather Your Credentials ................................................................................................................... 7
Getting Started with PowerShell ................................................................................................................8
Downloading Zerto cmdlets ........................................................................................................................ 8
Example PowerShell Script ......................................................................................................................... 8
Getting Started with Python .....................................................................................................................10
Example Python Script ............................................................................................................................. 10
Using the Encryption Detection API .........................................................................................................13
Interacting with the Windows Zerto Virtual Manager (Windows ZVM) ...................................................14
Connect to the Zerto Virtual Manager......................................................................................................... 14
Deploying Virtual Replication Appliances ................................................................................................... 15
Deploying Virtual Protection Groups .......................................................................................................... 18
Failover Test Script .................................................................................................................................. 24
Archived References ..................................................................................................................................27
Automating Zerto with PowerShell and REST APIs
2 of 28
Introduction
Zerto, a Hewlett Packard Enterprise company, empowers customers to run an always-on business by simplifying the
protection, recovery, and mobility of on-premises and cloud applications. Zerto eliminates the risk and complexity of
modernization and cloud adoption across private, public, and hybrid deployments. The simple, software-only solution uses
continuous data protection at scale to solve for ransomware resilience, disaster recovery, and multi-cloud mobility. Zerto is
trusted by over 9,500 customers globally and is powering offerings for Amazon, Google, IBM, Microsoft, Oracle, and more than
350 managed service providers.
This guide provides an overview of how to utilize PowerShell to start scripting powerful automated disaster recovery
procedures using Zerto REST APIs. Doing so enables the reduction of manual processes, scripting installations, integrating with
third-party tools, and the realization of the full benefits of software-defined replication and recovery in protecting a virtualized
IT infrastructure. This guide is for both Python and PowerShell users who may want to implement any of the use cases
mentioned:
?
Establishing a connection to the Zerto Virtual Machine (ZVM)
?
Automating virtual machine (VM) protection
?
Bulk Virtual Replication Appliance (VRA) deployment
?
Bulk Virtual Protection Group (VPG) configuration
?
Failover test
The examples given have been developed to meet the requirements of Zerto cloud and enterprise environments. The font size
of the examples given are optimized depending on the maximum line length to enable copying and pasting directly from the
PDF into your PowerShell and Python scripts.
What Are REST APIs?
An Application Programming Interface (API) is a set of clearly defined methods of communication between various software
components. Representational State Transfer (REST) determines what the API looks like. It is also a set of rules that developers
follow when creating an API. Together, a REST API allows you to query an API via a URL and request a response or send a
change to the API via a URL and modify the data.
The REST APIs utilized in the examples are all included within the Zerto API documentation set. The document does not intend
to give examples for all the available APIs. Its purpose is to give examples of the most requested use cases and share both
information and knowledge on how to customize and create automation scripts.
API Documentation
1.
Zerto Virtual Manager
2.
Zerto Analytics
3.
Zerto Cloud Manager
4.
Zerto In-Cloud for AWS
This paper focuses on using PowerShell with the Zerto Virtual Manager (ZVM) API, but the concepts are applicable more
broadly.
Except for the Zerto Cloud Manager (ZCM) APIs, all other Zerto APIs use Swagger.
Swagger accelerates the time to build and learn REST APIs by using the API itself to self-document and then comprehensively
describe its structure in a clear, interactive format.
Automating Zerto with PowerShell and REST APIs
3 of 28
About the Zerto Virtual Manager Appliance (ZVMA)
In 9.5U1, Zerto introduced a new Linux-based Zerto Virtual Manager Appliance (ZVMA), which differs from the ¡°classic¡± ZVM
installed on a Windows Server. First and foremost, authentication now uses Keycloak, an ¡°open-source identity and access
management¡± solution that supports a wide range of authentication methods. With that, scripts built for the classic ZVM will
not work without modification. Instead of embedding a username and password into a script, an administrator would create a
secret within Keycloak, call a Keycloak API with that secret, then receive a token to make calls to the APIs on the ZVMA going
forward.
The ZVMA, which is replacing the Windows-based ZVM, is a complete overhaul. Here are the major changes that affect
automation with the REST API:
? New HTTPS port¡ª443 (replaces the previously used 9669)
? New authentication process via Keycloak (replaces ¡°session¡± API)
? Login credentials sources via Keycloak (replaces previous requirement of entering vCenter credentials)
Before you script in either PowerShell or Python, you first must create Keycloak credentials.
Creating Keycloak Credentials
For scripts that will run all the time, the best thing to do is create a Keycloak client and then use the client_id and client_secret
in your script. To obtain this information, please perform the following:
Step 1: Log in to Keycloak
?
From any browser, navigate to
If this is your first time logging in, and you didn¡¯t already change the password, use the default login information:
?
Username: admin
?
Password: admin
Automating Zerto with PowerShell and REST APIs
4 of 28
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- automating zvr with powershell and rest apis
- export csv powershell examples
- powershell basic cheat sheet rambling cookie monster
- windows powershell for
- powershell command line conversion guide active directory
- powershell 2 0 one cmdlet at a time
- export array to csv powershell
- powershell for beginners line in 24 hours
Related searches
- meal and rest breaks by state
- new york meal and rest break requirements
- texas meal and rest breaks laws
- flsa meal and rest breaks
- meal and rest break policy
- new york meal and rest breaks
- meal and rest break chart
- meals and rest periods california
- powershell call rest service
- meal and rest break laws california
- meal and rest breaks in california
- colorado meal and rest breaks