- It uses admin or co-admin login email address to find the associated enterprise and the zone policy assigned to this enterprise. An assigned zone policy is inherited by all users unless specified otherwise. It is sometimes called the default zone.
- It performs zone assignment based on an input
.csvfile containing user email addresses and zone mappings.
Prerequisites
Windows
Install the latest version of dotnet core.MacOS & Linux
Install PowerShell. Run thepwsh command to test the installation.
Set up application with JWT authentication
To use the script, you will need the Box CLI with JWT authentication installed and configured. When creating the app, use the Configuration tab to configure the following settings:- In App Access Level, select
App + Enterprise Access. - In Application Scopes > Administrative Actions, select
Manage Enterprise Properties,Manage Users. - In Advanced Features, select
Generate user access tokens.
Adjust admin settings
Make sure Box Admin or Co-Admin has at leastManage Users privileges.
To check this setting:
- Go Users & Groups section in the Admin Console.
- Click the user account you want to verify.
- Go to Edit User Access permissions section to grant the administrative privileges for users and groups.
Prepare the .csv file
The .csv file must have two columns with the following headers: Email and Region.
- Email contains the primary email address of a Box user.
-
Region contains the user-friendly name for the zone to which the script will assign the user. This name is provided by the ZonesTable that is a hash table used to define zones. The keys are the zone’s user-friendly names, and the corresponding value is the global ID of the zone.
.csv file containing emails and zone names is provided with this script. Its content looks as follows:
| Region | |
|---|---|
[email protected] | US |
[email protected] | France |
[email protected] | JapanSingapore |
Configure the script
Set theUserZonesUpdatePath to point to your .csv file.
adminEmail to the admin or co-admin login email address of the account the script will use to make zone assignments.
If you don’t specify this value, the script will prompt you for it.
Run the script
Run the Powershell command.Optional flags
To run the script in a simulation mode, add theDryRun boolean flag.
Dry run doesn’t mean that API calls won’t be made, but that any create/update/delete calls will be skipped.
Logging
Logs are stored in alogs folder located in the main folder.
You have access to these log files:
Mass_Update_User_Zones_all.txtthat contains all log entries.Mass_Update_User_Zones_errors.txtthat contains only errors.
