<?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 Enterprise User in ArcGIS Online using REST or Python API in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/1394738#M4696</link>
    <description>&lt;P&gt;I realize this was years ago, but I am curious if it possible to use create users with&amp;nbsp;&lt;SPAN&gt;ArcGIS API for Python to create users in bulk. Or does it have to be one by one using the code you provided?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Mar 2024 16:06:39 GMT</pubDate>
    <dc:creator>chill_gis_dude</dc:creator>
    <dc:date>2024-03-12T16:06:39Z</dc:date>
    <item>
      <title>Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737142#M3523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Geo Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot find any examples to create an enterprise user using ArcGIS REST API. While my focus was to use ArcGIS API for Python to do so,&amp;nbsp;I was told by Esri Level 1 CSA that It is not possible to create enterprise users ( We have ADFS as SAML Identity Provider and integrated with AGOL).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't find any REST API examples in python for reference. I can generate a token successfully with this code.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;def genTokenInAGOL():&lt;/P&gt;&lt;P&gt;payload = "client_id=" + clientID + "&amp;amp;client_secret=" + clientSecret + "&amp;amp;grant_type=client_credentials"&lt;BR /&gt; headers = {&lt;BR /&gt; 'content-type': "application/x-www-form-urlencoded",&lt;BR /&gt; 'accept': "application/json",&lt;BR /&gt; 'cache-control': "no-cache"&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;response = requests.request("POST", agolUrl, data=payload, headers=headers)&lt;BR /&gt; responseInJson = response.json()&lt;BR /&gt; return responseInJson['access_token']&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Just wanted to Create a new enterprise user account.&amp;nbsp; Also, I do get confused with Idp_Username and Username in Create object. For provider=enterprise, do both have to be there?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2019 19:27:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737142#M3523</guid>
      <dc:creator>NareshAligeti1</dc:creator>
      <dc:date>2019-08-29T19:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737143#M3524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you would like to do this via the ArcGIS API for Python, then there is some basic info here:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/python/guide/accessing-and-managing-users/#creating-new-user-accounts" rel="nofollow noopener noreferrer" target="_blank"&gt;Creating new user accounts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately that doc does not include&amp;nbsp;a complete example for the specific case of creating enterprise logins,&amp;nbsp;however, I've&amp;nbsp;found code like the snippet below works. (If you leave out parameters, like password, which it shouldn't need, you get unexpected errors.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;new_enterprise_user = gis.users.create( 
&amp;nbsp;&amp;nbsp;&amp;nbsp;username = 'xxxxxxxx_umich',
&amp;nbsp;&amp;nbsp;&amp;nbsp;password = 'None', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;firstname = 'First',
&amp;nbsp;&amp;nbsp;&amp;nbsp;lastname = 'Last', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;email = 'xxxxxxxx@umich.edu', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;role = 'org_publisher', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;provider = 'enterprise', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;idp_username = 'xxxxxxxx',
&amp;nbsp;&amp;nbsp;&amp;nbsp;level = '2', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;user_type = 'creator' 
)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:51:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737143#M3524</guid>
      <dc:creator>PeterKnoop</dc:creator>
      <dc:date>2021-12-12T16:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737144#M3525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Peter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I was told by Esri that this would still create built-in user accounts and not enterprise accounts.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2019 20:15:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737144#M3525</guid>
      <dc:creator>NareshAligeti1</dc:creator>
      <dc:date>2019-08-29T20:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737145#M3526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just verified that it still works&amp;nbsp;correctly with our ArcGIS Online organization. Accounts created are enterprise accounts, not built-in, arcgis accounts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have been relying on this method for awhile now, so I suspect the person with which you communicated at Esri may be mis-informed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, our ArcGIS Online instance is configured to automatically&amp;nbsp;join&amp;nbsp;authorized enterprise users to our organization, so&amp;nbsp;a user is able to do whatever they need to the first time they login.&amp;nbsp;Sometimes, however, circumstances arise where we need to add an enterprise user to a specific group, before they have logged in that first time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As&amp;nbsp;the user has not&amp;nbsp;logged in before, their enterprise account doesn't yet exist in the system, so we cannot add them to the group. Therefore, we use&amp;nbsp;we use the above method&amp;nbsp;to create enterprise accounts,&amp;nbsp;so that we can add users&amp;nbsp;to the groups, even if they haven't logged in themselves previously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I mentioned, if you don't supply all the parameters it is expecting, then you get unexpected errors. In same cases this means an account is created, but it is a built-in account, rather than an enterprise account.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Give it a try.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Aug 2019 21:15:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737145#M3526</guid>
      <dc:creator>PeterKnoop</dc:creator>
      <dc:date>2019-08-29T21:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737146#M3527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Peter, It worked. I did not know that I had to supply&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;password='None'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;for an enterprise user account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the script if someone wants to copy and take it to the next level. I need to add more code to it to work with AGE&amp;nbsp; and built-in accounts and give it some try catch and loggers to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from arcgis.gis import RoleManager&lt;BR /&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;gis = GIS(url="https://company.maps.arcgis.com", username="snknkdnk", password="******")&lt;/P&gt;&lt;P&gt;'''&lt;BR /&gt;role_mgr = RoleManager(gis)&lt;BR /&gt;roles = role_mgr.all()&lt;/P&gt;&lt;P&gt;for role in roles:&lt;BR /&gt; print("{}: {}".format(role.name, role.role_id))&lt;BR /&gt;'''&lt;/P&gt;&lt;P&gt;agolIntUsers = []&lt;BR /&gt;agolExtUsers = []&lt;BR /&gt;for user in gis.users.search('!esri_ &amp;amp; !admin', max_users=1000):&lt;BR /&gt; if "@company" in user.email:&lt;BR /&gt; agolIntUsers.append(user.username)&lt;BR /&gt; else:&lt;BR /&gt; agolExtUsers.append(user.email)&lt;/P&gt;&lt;P&gt;def addUserToAGOL_and_Group(lname, fname, username, email, role, level, group):&lt;BR /&gt; requestedGroup = (gis.groups.search('title:{}'.format(group))[0]).title&lt;BR /&gt; appendedUsername = username + "_comp_gis"&lt;BR /&gt; print("Checking if {} {} exists in ArcGIS Online..".format(fname, lname))&lt;BR /&gt; if (appendedUsername) not in agolIntUsers:&lt;BR /&gt; print("\tChecked.\nCreating user account for {} {} in ArcGIS Online..".format(fname, lname))&lt;BR /&gt; gis.users.create(username=appendedUsername, password='None', lastname=lname, firstname=fname, idp_username=email, user_type=level, description= '', email=email, role=role, level=level, provider='enterprise')&lt;BR /&gt; print ("\tCreated.\nAllocating default credits to user..")&lt;BR /&gt; gis.admin.credits.allocate(username=appendedUsername, credits=1)&lt;BR /&gt; print("\tAllocated.")&lt;BR /&gt; else:&lt;BR /&gt; print("\t{} {} account already exists in ArcGIS Online.".format(fname, lname))&lt;BR /&gt; &lt;BR /&gt; print("Checking if {} {} is a member of {} group..".format(fname, lname,requestedGroup))&lt;BR /&gt; &lt;BR /&gt; if requestedGroup.lower() == group.lower():&lt;BR /&gt; userGroup = gis.groups.search('title:{}'.format(group))[0]&lt;BR /&gt; if (appendedUsername) not in userGroup.get_members()['users']:&lt;BR /&gt; print("\tChecked.\nAdding {} {} to the {} group..".format(fname, lname,requestedGroup))&lt;BR /&gt; userGroup.add_users(appendedUsername)&lt;BR /&gt; print("\tAdded.")&lt;BR /&gt; else:&lt;BR /&gt; print("\t{} {} is already a member of {} group.".format(fname, lname, requestedGroup))&lt;BR /&gt; else:&lt;BR /&gt; print("\tNo group named {} in AGOL.".format(requestedGroup))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;addUserToAGOL_and_Group('LastName', 'FirstName', 'MyUsername','MyUsername@company.com', 'Role_Id', 'Creator', 'AGOL_Group')&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Aug 2019 21:36:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/737146#M3527</guid>
      <dc:creator>NareshAligeti1</dc:creator>
      <dc:date>2019-08-30T21:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/1394738#M4696</link>
      <description>&lt;P&gt;I realize this was years ago, but I am curious if it possible to use create users with&amp;nbsp;&lt;SPAN&gt;ArcGIS API for Python to create users in bulk. Or does it have to be one by one using the code you provided?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 16:06:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/1394738#M4696</guid>
      <dc:creator>chill_gis_dude</dc:creator>
      <dc:date>2024-03-12T16:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create Enterprise User in ArcGIS Online using REST or Python API</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/1481806#M4760</link>
      <description>&lt;P&gt;Yes it is possible with the ArcGIS API for Python:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Connect as an admin and get a GIS() object&lt;UL&gt;&lt;LI&gt;gis = GIS(portal_url, admin_account, password)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;For loop for the file with the user data&lt;UL&gt;&lt;LI&gt;gis.users.create(**&lt;SPAN&gt;create_user_dict&lt;/SPAN&gt;)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 05:21:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/create-enterprise-user-in-arcgis-online-using-rest/m-p/1481806#M4760</guid>
      <dc:creator>rob_hewy</dc:creator>
      <dc:date>2024-05-31T05:21:37Z</dc:date>
    </item>
  </channel>
</rss>

