70844: Acronis Cyber Protect Cloud: Mass Enablement Script for maintenance notifications

use Google Translate

Last update: 21-12-2022

Starting from C22.07, Acronis will release a standalone script for mass enablement.

The script will allow partners to perform mass operations related to maintenance notifications. 

Script

Download the script and unpack it.

Requirements

  • "Support access" enabled for all relevant tenants
  • Python version required: 3.9 or newer
  • "Requests" is required (pip install requests)
  • Create an API Client

Usage

mass_enablement.py [-h] [--client-id CLIENT_ID] [--client-secret CLIENT_SECRET] [--http] [-v] [--log-dir LOG_DIR] [--dry-run] [--ignore-errors] [-y] --dc-address DC_ADDRESS [--tenant-id TENANT_ID] [--traverse] [--non-partner] [--disable] [--subscribe-users]

 

Optional arguments -h, --help Show this help message and exit
Authentication options --client-id <CLIENT_ID> Your API client ID.
--client-secret <CLIENT_SECRET> Your API client secret
http options --http use http instead of https
logging options

-v, --verbose

enable debug logging to the terminal (debug logging always available in files)
--log-dir <LOG_DIR> path to logging directory (default is current directory)
behavioral options --dry-run run the command without actually executing any state-changes. This can be useful to see which tenants/users will be modified before actually doing it
--ignore-errors continue running when non-fatal errors occur (dangerous!)
--yes perform actions without asking for approval each time
input options

--dc-address<DC_ADDRESS>

Your DC address. Example: `https://us-cloud.acronis.com`
--tenant-id <TENANT_ID> tenant ID for start of this operation. Defaults to tenant ID of user running the script. Must be supplied if root or sub-root admin is used
--traverse   traverse the tenant hierarchy to enable maintenance notifications for all child tenants
--non-partner allow enabling maintenance notifications for all tenant types (except root)
--disable disable maintenance notifications instead of enabling
--subscribe-users subscribe all users under each tenant

 

By default, the script will ask for confirmation before performing any state changes and will only enable notifications for the authenticated tenant and direct partner children. A log file is created in the current directory with more verbose logging.

If you attempt to enable maintenance notifications for a root tenant, it is not allowed. even with --ignore-errors

 

 

Examples

Enabling maintenance notifications for current tenant and direct children, partner types only

$ python3 mass_enablement.py --dc-address mc-hyb-13405.do.acronis.fun 

    Please enter your client ID: b8187506-8b36-4a8d-b072-051f7f6abb98
    Please enter your secret key:
    Starting with tenant as root: (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)

    Enable maintenance notifications for tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)

    Enable maintenance notifications for child (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)
    Skipping Child (name=calvinChildCustomer1, id=953130d4-4418-4143-91e8-6ad698ff9fd2) because Kind is customer
    Done
    ```
 

Enabling maintenance notifications for non-partner users

$ python3 mass_enablement.py --dc-address mc-hyb-13405.do.acronis.fun --non-partner
    Please enter your client ID: b8187506-8b36-4a8d-b072-051f7f6abb98
    Please enter your secret key:
    Starting with tenant as root: (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)

    Enable maintenance notifications for tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)

    Enable maintenance notifications for child (name=calvinChildCustomer1, id=953130d4-4418-4143-91e8-6ad698ff9fd2)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinChildCustomer1, id=953130d4-4418-4143-91e8-6ad698ff9fd2)

    Enable maintenance notifications for child (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)
    Done
    ```

Enable direct children and subscribe their users

$ python3 mass_enablement.py --dc-address mc-hyb-13405.do.acronis.fun --subscribe-users
    Please enter your client ID: b8187506-8b36-4a8d-b072-051f7f6abb98
    Please enter your secret key:
    Starting with tenant as root: (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)

    Enable maintenance notifications for tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)
    Found 1 users for tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)
    Successfully subscribed all users for tenant (name=calvinPartner, id=2c4fe3b6-5d0b-41b9-a1d9-835cd104bc16)
    Skipping Child (name=calvinChildCustomer1, id=953130d4-4418-4143-91e8-6ad698ff9fd2) because Kind is customer

    Enable maintenance notifications for child (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)? [y/N] y
    Enabling maintenance notifications for Tenant (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)
    Found 1 users for tenant (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)
    Successfully subscribed all users for tenant (name=calvinChildPartner1, id=5b83a0a8-f71e-4305-9394-3338d633e8b9)

 

More Information

If further assistance is needed, please contact Acronis Support.

Tags: