Meraki users may encounter a scenario where they must manage multiple Meraki dashboard organizations, whether by necessity (scale) or for management purposes. This is also common for managed service providers who help more than one customer.

A Python-based script has been developed by our open source community in order to help our users quickly and programmatically add, delete, find, and list administrators across organizations.

Source Code

 

Prerequisites

To run the script, you need to install Python 3 and the Requests module first. More information on installing these components for your operating system can be found here:

https://www.python.org/downloads/

http://docs.python-requests.org/en/master/user/install/

 

Installation

To install the script itself, copy the script and the sample init file into a directory on your workstation or server from Github:

https://github.com/meraki/automation-scripts/blob/master/usagestats.py

https://github.com/meraki/automation-scripts/blob/master/usagestats_initconfig.txt

 Note: This script was developed using Python 3.6.4. You will need the Requests module to run it:

pip install requests

 

Meraki Dashboard API

The script uses the Meraki Dashboard API to get information from and make changes to the configuration of elements in the Meraki cloud. You will need a Meraki Dashboard API key in order to run the script. More information on the Dashboard API, how to enable it for an organization and how to create a key can be found here:

https://documentation.meraki.com/zGeneral_Administration/Other_Topics/The_Cisco_Meraki_Dashboard_API

The script requires organization-level access privileges to run. Dashboard API keys have the same privilege level as the administrator account they are tied to. An explanation of different Dashboard administrator privilege levels can be found here:

https://documentation.meraki.com/zGeneral_Administration/Managing_Dashboard_Access/Managing_Dashboard_Administrators_and_Permissions

 

Using the Script

To run the script, enter:
python manageadmins.py -k <api key> -o <organization> -a <admin account email> -n <admin name> -p <privilege>

Mandatory arguments:

-k <api key> : Your Meraki Dashboard API key
-o <organization> : Dashboard organizations in scope. Valid forms:
-o <org name> Organizations with matching name. Use * for wildcard (one * only)
-o /all All organizations accessible by your API key
-c <command> : Command to be executed. Valid forms:
-c add Add an administrator
-c delete Delete an administrator
-c find Find organizations in scope accessible by a specific admin
-c list List administrators

Optional arguments:

-a <admin account> : Email of admin account to be added/deleted/matched. Required for commands add, delete and find
-n <admin name> : Name for admin to be added by the "add" command. Required for "add".
-p <privilege level> : Privilege level for admin to be added by the "add" command. Default is "full". Valid options:
-p full Full organization admin
-p read-only Read only organization admin

Examples

Remove administrator user “[email protected]” from all organizations

python manageadmins.py -k 1234 -o /all -c delete -a [email protected]

Add admin “[email protected]” to all organizations with a name starting with “TIER1_”:

python manageadmins.py -k 1234 -o TIER1_* -c add -a [email protected] -n Miles