<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create User Fails in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098837#M6645</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've had success creating enterprise users with the following at 10.8.1:&lt;/P&gt;&lt;P&gt;target_user = target_portal.users.create(source_user.username, password, first_name,&amp;nbsp;&lt;BR /&gt;last_name, source_user.email,&amp;nbsp;&lt;BR /&gt;source_user.description,&amp;nbsp;&lt;BR /&gt;provider=\"enterprise\",&amp;nbsp;&lt;BR /&gt;level=int(source_user.level),&lt;BR /&gt;role=user_role)&lt;/P&gt;</description>
    <pubDate>Thu, 16 Sep 2021 07:55:40 GMT</pubDate>
    <dc:creator>mdonnelly</dc:creator>
    <dc:date>2021-09-16T07:55:40Z</dc:date>
    <item>
      <title>Create User Fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098812#M6643</link>
      <description>&lt;P&gt;My portal is configured for Azure/Saml Authentication. Purposed of creating user is to enable automation of creating users. I'd the code working successfully in 10.6.1 but upgrading to 10.7.1 is failing. I'm seeing when creating a user.&amp;nbsp;&lt;/P&gt;&lt;P&gt;500,"message":"The user's role does not allow the specified user type to be set.","details":null}}:&lt;BR /&gt;15-Sep-21 23:06:25:ERROR:The user's role does not allow the specified user type to be set.:&lt;/P&gt;&lt;P&gt;Same code worked in 10.6.1 but wondering what is failing in 10.7.1. Any help is really appreciated or may be an example for 10.7.1 reference will be great. I'm unable crack the code from&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/portal/create-user.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/enterprise-administration/portal/create-user.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 04:17:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098812#M6643</guid>
      <dc:creator>RamakrishnaBillakanti</dc:creator>
      <dc:date>2021-09-16T04:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create User Fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098817#M6644</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/16932"&gt;@RamakrishnaBillakanti&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Is it possible to share your script?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 05:37:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098817#M6644</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-09-16T05:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create User Fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098837#M6645</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've had success creating enterprise users with the following at 10.8.1:&lt;/P&gt;&lt;P&gt;target_user = target_portal.users.create(source_user.username, password, first_name,&amp;nbsp;&lt;BR /&gt;last_name, source_user.email,&amp;nbsp;&lt;BR /&gt;source_user.description,&amp;nbsp;&lt;BR /&gt;provider=\"enterprise\",&amp;nbsp;&lt;BR /&gt;level=int(source_user.level),&lt;BR /&gt;role=user_role)&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 07:55:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098837#M6645</guid>
      <dc:creator>mdonnelly</dc:creator>
      <dc:date>2021-09-16T07:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create User Fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098890#M6646</link>
      <description>&lt;P&gt;def addUsersToArcGisPortalGroups():&lt;BR /&gt;logging.debug("\nSyncing groups between AzureAD and Mobile Portal by adding new members to Portal using list from AzureAD\n")&lt;BR /&gt;print("\nSyncing groups between AzureAD and Mobile Portal by adding new members to Portal using list from AzureAD\n")&lt;BR /&gt;allPortalUsers = gis.users.search()&lt;BR /&gt;usernames = []&lt;BR /&gt;logging.debug("ADMIN group:")&lt;BR /&gt;print("ADMIN group:")&lt;BR /&gt;for userid in allPortalUsers:&lt;BR /&gt;usernames.append(userid['username'])&lt;BR /&gt;if len(adminsToADD) != 0:&lt;BR /&gt;for admin in adminsToADD:&lt;BR /&gt;fname = (adminusersDict[admin]['NAME'].split(", ", 1)[1]).split(" ", 1)[0]&lt;BR /&gt;lname = adminusersDict[admin]['NAME'].split(", ", 1)[0]&lt;BR /&gt;email = (adminusersDict[admin]['UID']) + "@Org.com"&lt;BR /&gt;#email = (adminusersDict[admin]['UID']).upper() + "@Org.com"&lt;BR /&gt;idp_username = email&lt;BR /&gt;username = email&lt;BR /&gt;password = None&lt;BR /&gt;description = "IT-GIS Admins, who have the highest privileges"&lt;BR /&gt;#Note: A possible esri bug is causing createUser function to fail when role names are given as-is.&lt;BR /&gt;# Hence I have used system generated role name by taking a fiddler capture of the form data after manually adding users to portal&lt;BR /&gt;role = 'account_admin'#"org_admin"&lt;BR /&gt;provider = 'enterprise'&lt;BR /&gt;level = 2&lt;BR /&gt;&lt;BR /&gt;if (admin + "@Org.com") not in usernames:&lt;BR /&gt;logging.debug("\t{} {} is not a member of Mobile Portal. Adding..".format(fname.capitalize(), lname.capitalize()))&lt;BR /&gt;print("\t{} {} is not a member of Mobile Portal. Adding..".format(fname.capitalize(), lname.capitalize()))&lt;BR /&gt;gis.users.create(username=username,&lt;BR /&gt;firstname = fname,&lt;BR /&gt;lastname = lname,&lt;BR /&gt;password = password,&lt;BR /&gt;email = email,&lt;BR /&gt;idp_username = idp_username,&lt;BR /&gt;description = description,&lt;BR /&gt;role = role,&lt;BR /&gt;provider = provider,&lt;BR /&gt;level = level)&lt;BR /&gt;logging.debug("\t\tAdded")&lt;BR /&gt;print("\t\tAdded")&lt;BR /&gt;else:&lt;BR /&gt;logging.debug("\tUser is already a member of portal")&lt;BR /&gt;print("\tUser is already a member of portal")&lt;/P&gt;&lt;P&gt;admingroups = ('Org - Mobile Admins', 'Org Tenant', 'Org - Mobile Viewers')&lt;BR /&gt;for admgroup in admingroups:&lt;BR /&gt;admini = gis.groups.search(admgroup)[0]&lt;BR /&gt;if username not in admini.get_members().get('users'):&lt;BR /&gt;logging.debug("\tAdding {} {} - {} to {} built-in group".format(fname.capitalize(), lname.capitalize(), admin, admgroup))&lt;BR /&gt;print("\tAdding {} {} - {} to {} built-in group".format(fname.capitalize(), lname.capitalize(), admin, admgroup))&lt;BR /&gt;admini.add_users(username)&lt;BR /&gt;logging.debug("\t\tAdded")&lt;BR /&gt;print("\t\tAdded")&lt;BR /&gt;&lt;BR /&gt;else:&lt;BR /&gt;logging.debug("\tUser is already a member of {0} built-in group".format(admgroup))&lt;BR /&gt;&lt;BR /&gt;logging.debug("\tADMIN group is now in Sync\n")&lt;BR /&gt;print("\tADMIN group is now in Sync\n")&lt;BR /&gt;&lt;BR /&gt;else:&lt;BR /&gt;logging.debug("\tADMIN group is already in Sync\n\n")&lt;BR /&gt;print("\tADMIN group is already in Sync\n\n")&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 13:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1098890#M6646</guid>
      <dc:creator>RamakrishnaBillakanti</dc:creator>
      <dc:date>2021-09-16T13:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create User Fails</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1099212#M6649</link>
      <description>&lt;P&gt;Try dropping the idp_username parameter. I don't use it and I am able to create enterprise users.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 23:31:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-user-fails/m-p/1099212#M6649</guid>
      <dc:creator>mdonnelly</dc:creator>
      <dc:date>2021-09-16T23:31:06Z</dc:date>
    </item>
  </channel>
</rss>

