Help Cloning Items Using Jupyter Notebook

2534
11
06-09-2021 07:52 AM
DaveK
by
Occasional Contributor

Hello! 

I'm trying to clone items from our AGO to our organizations enterprise Portal and vice versa. When connecting to my AGO account through the notebook it seems to work just fine. It alerts me that I am logged in as an administrator. When connecting to my Portal account it throws a number of errors including a connection error. Do I need to be an administrator to complete the cloning? Is there any issue with our portal being behind a firewall? and lastly, is an advanced license of Notebook server required for this? Are any of the ArcPy modules required for the cloning process? We currently only have a standard server license. Any help on this topic is appreciated. 

Thanks. 

 

0 Kudos
11 Replies
ReeseFacendini
Esri Regular Contributor

Clone items is done through the Python API and does not use arcpy modules, so no you don't need to have an advanced license to run it.  You don't need to be an administrator for either system, but it often helps cut down on permission issues that can come up.  When attempting to connect to your Enterprise Portal, are you doing that from Notebooks in ArcGIS Online?  If so, is your Enterprise Portal public facing?

0 Kudos
DaveK
by
Occasional Contributor

Hey @ReeseFacendini,

Good to know we don't need an advanced license. I am using the notebooks within ArcGIS Online. Our Portal is not public facing. 

0 Kudos
ReeseFacendini
Esri Regular Contributor

If your Portal is not public facing, then using Notebooks in ArcGIS Online won't work.  ArcGIS Online has no way to find your Portal behind a firewall.  With that being said, you can use Jupyter Notebooks from ArcGIS Pro on a machine within your network that can access your Portal and ArcGIS Online.  All the functions will be the same from the Notebooks in AGOL and Pro, and this would solve the connection errors you are seeing.

DaveK
by
Occasional Contributor

Hey @ReeseFacendini , 

Thanks for the info! I'm using notebooks within ArcPro on a machine within our network. After trying to connect to our Portal, I receive this message. 

DaveK_0-1624289501609.png

I'm on step 2 of this guide - https://support.esri.com/en/technical-article/000022252

I've entered my portal URL and my username and password. 

DaveK_2-1624289656580.png

Is there something different I should be doing or does something need to happen on the Portal end to enable access? 

Thanks. 

 

0 Kudos
ReeseFacendini
Esri Regular Contributor

Hi @DaveK, yes there is one parameter you need to add to that connection string.  Add the verify_cert=False piece to the end of the GIS line (see below).  This will tell the Python API to not try and validate the SSL certificate.

cnx = GIS(url=portalURL, username=portalUser, password=portalPass, verify_cert=False)

 

0 Kudos
DaveK
by
Occasional Contributor

Hi @ReeseFacendini , 

That worked. I ran the final steps of the process and it came back with this message: 

DaveK_0-1624298558951.png

I also don't see any new content in my AGO account (I'm moving items from our Portal to AGO)

0 Kudos
ReeseFacendini
Esri Regular Contributor

I think you are passing a full list, where clone_items wants a single object.  I suggest iterating through your list of items to be copied and calling clone_items for each iteration

0 Kudos
DaveK
by
Occasional Contributor

Hey @ReeseFacendini

I believe I'm passing a single item into the script with just the item ID. If I still need to iterate through my items, how would I do so? 

DaveK_1-1625142467406.png

Thanks. 

 

0 Kudos
ReeseFacendini
Esri Regular Contributor

The line where you are calling clone_items within the try / except block,  you are passing a list (even though it only has a single item in it).  Change the line to read "gis2.content.clone_items(item, copy_data=True, search_existing_items=True)

0 Kudos