I am currently standing up an AGOL environment that will have 1000 licenses. This is a standalone site (PDS) for a very specific project where users from different organizations will be accessing and contributing content. I am looking for a way to "automate" allocating licenses. The problem is, we do not have a list of potential users and users may request a license at anytime across a 6 month period.
Rather than subject an employee to assigning and monitoring licenses, we would like a way to potentially automate some or all of this process. My first thought was "Surely Esri has a tool for this!" but no, nothing exists... I have been looking into a python solution, but am not sure this is even possible.
Anyone here have experience with automating AGOL license allocation? Or have any ideas?
You can use Python to create users below are the samples included in the API Reference
You can also do it from the REST API as well:
https://developers.arcgis.com/rest/enterprise-administration/portal/create-user/
#Usage Example 1: New ArcGIS Online user using `New Member Defaults`
>>> ago = GIS(profile='your_online_admin_profile')
>>> for k,v in ago.users.user_settings.items():
>>> print(f'{k:20}{v}')
role org_publisher
userLicenseType advancedUT
groups ['96c9a826e654481ba2cf8f6d04137b32']
userType arcgisonly
apps []
appBundles []
categories []
>>> new_user = ago.users.create(username= 'new_unique_username',
password= '<strong_password>',
firstname= 'user_firstname',
lastname= 'user_lastname',
email= 'user_email@company.com',
description= 'new user using member defaults'))
# Usage Example 2: New ArcGIS Online user with custom role and non-default `user_type`
# Get RoleManager and print `role_id` values for `role` argument
>>> role_mgr = gis.users.roles
>>> for role in role_mgr.all():
>>> print(f'{role.name} {role.role_id}')
Viewer iAAAAAAAAAAAAAAA
Data Editor iBBBBBBBBBBBBBBB
CustomRole bKrTCjFF9tKbaFk8
# Print valid values for `user_type` argument
>>> [ut['id'] for ut in ago.users.license_types]
['advancedUT',
'basicUT',
'creatorUT',
'editorUT',
'fieldWorkerUT',
'GISProfessionalAdvUT',
'GISProfessionalBasicUT',
'GISProfessionalStdUT',
'IndoorsUserUT',
'insightsAnalystUT',
'liteUT',
'standardUT',
'storytellerUT',
'viewerUT']
>>> user1 = ago.users.create(username='new_unique_username',
password='<strong_password>',
firstname="user_firstname",
lastname="user_lastname",
email="user_email@company.com",
description="Test user with custom role and non-default user type.",
role='bKrTCjFF9tKbaFk8',
user_type='creatorUT')
# Usage Example 3: New User invited with an email:
>>> user_e = ago.users.create(username="new_invited_uk_Q42eklm",
password="S8V3*t4L8tr!&",
firstname="user_firstname",
lastname="user_lastname",
email="user_email@company.com",
description="Test for an invited user to Online.",
user_type="creatorUT",
role="XBH3xJArWxYuK2qX",
email_text="Welcome aboard the Web GIS organization!")