I am having a difficulty of creating ArcGIS Online enterprise account using ArcGIS API for Python.
Here is the story:
I work in higher-ed. We use enterprise login making the workflow of logging in to AGO easier for students. However, this brings a problem. The account won't be created until the student login to AGO the first time. As an instructor, we would like to prepare materials before the lab, like creating groups, adding students to the groups and sharing materials with groups. We send emails to students before the lab, asking them to login to ArcGIS online one week before the lab. But there are always some students miss our emails. We usually have to spend the first 10-15 mins of the lab to have all the students login and are added to the group. If we can create enterprise accounts for students before labs, we won't have to go through all the workflows. This is why we want to create users automatically before labs using ArcGIS API for Python.
This is the piece of python script of creating an account for myself. For example, my enterprise idp username is "lr300"
student = gis.users.create(idp_username = "lr300",
username = "lr300_BU",
password = 'mypassword1234',
firstname = "myfirstname",
lastname = "mylastname",
email = "email@example.com",
role = 'org_publisher',
provider = 'enterprise')
After I run this python script, an account "lr030_Bucknell" is created successfully(Please see attached screenshot 1). But then I try to log in to our ArcGIS Online with enterprise logint, it failed and gave me this error "Unable to assign user 'lr300_BU' to this account 'xsh7pVZv42relbEf' , Username is not available". (Please see the attached screenshot 2.)
Is anyone familiar with this issue? Any ideas?