ControlHub

The Control Hub Repository contains scripts intended to be run by Webex Control Hub Organization Administrators to simplify and automate their
workflows, especially when bulk operations are involved.

For now, only Bulk Email Update is available but if you would like another bulk operation to be implemented, please feel free to contact me at
anpapath@cisco.com.

Bulk Email Update

Oftentimes, administrators face the challenge that they need to change either the names or the domains of their user email addresses. While the bulk csv update is very convenient for the bulk update of the licenses of the users in Control Hub, the email address column is the only inmutable one in the csv template, making the change of email addresses painful for the administrators as it should be done manually user after user.

The bulkUpdateEmails.py script is using the Personal Access Token of the administrator of a specific Control Hub Organization in order to perform the change of email addresses in bulk with minimal manual intervention from the Administrator. The Administrator only requires to construct the input file which contains the mapping between the previous and the new email address for the users they will need to update.

After providing the script with the input file and their personal token, the script is taking care to change the user email addresses and writes to an output file to be reviewed by the Administrator, containing potential errors, if any.

After the successful execution of the script, users in Control Hub will appear as "Not Verified". This is no reason to be alarmed. Upon their next login with the new email address, they will receive an email in their new mailbox to activate their accounts. Once they activate their account completing the login process, their account should appear as Active in Control Hub.

Installation

Clone the repo

git clone https://github.com/anpapath/ControlHub.git

Go to your project folder

cd cisco-control-hub

Set up a Python venv

First make sure that you have Python 3 installed on your machine. We will then be using venv to create an isolated environment with only the necessary packages.

Install virtualenv via pip

pip install virtualenv

Create the venv

python3 -m venv venv

Activate your venv

source venv/bin/activate

Install dependencies

pip install -r requirements.txt

Limitations

  1. The code does not retry to update a user after it encounters an error 4xx/5xx with the email update. The code will only be logged into Errors.csv and in order to update those users, the administrator, depending on the error, will need to re-run the script for the failed users.

  2. The script is assigning back to the users their basic attributes: emails, displayName, firstName, lastName, orgId, licenses and roles. If in your environment users have additional attributes, e.g avatars, you would need to get those values from the GET request and re-assign it back with the PUT request. If you don't, in the case of avatars, the avatars of your users will be lost and will need to be cleared from the backend (with a TAC case) and reuploaded. More details for all the attributes a user can have, here: https://developer.webex.com/docs/api/v1/people/get-person-details

Things to be aware of before you run this script

  1. If you have Directory Synchronization, for the love of god, please disable it before you run this script. If you don't you risk data loss for your users. Not fun :) The flow of work if you have DirSync enabled would be:
    a. Disable DirSync
    b. Update user emails in Control Hub
    c. Update user emails in Active Directory so they match with the new ones in Control Hub
    d. Once you have ensured the email addresses match - Enable back DirSync.

  2. Since this script uses the personal token of a specific user, it can only run for 12 hours non stop, the amount of time that the personal token is valid from the moment the Administrator logs in into the Developer Portal. While the amount of users that you can update in one go can vary depending on your input file size, processing power and network conditions it would be a good idea to try and split your user base into smaller chunks and parallelize the procedure of updating the user emails if you have let's say more than 10k users.

Getting Help

If you face any issues with the code or you would like to adjust it to your particular scenario, please feel free to reach out at anpapath@cisco.com

Other Bulk Operations

You can check out the Bulk Delete Users by Matt Klawiter: https://github.com/mklawiter/webexControlHubScripts/blob/primary/BulkDeleteUsers.py

And the relative Webex Help Article: https://help.webex.com/en-us/article/hglkq6/Bulk-Delete-Users

View code on GitHub
  • Owner

  • Contributors

    +1Github contributor
  • Categories

  • Products

    Webex
  • Programming Languages

    Python
  • License

    Other

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.