TLDR:
How do I create a publisher connections?
---
Using arcgis 3.1, I'm trying to automate publishing of MapServcies using arpy.sharing.
Inspo from https://pro.arcgis.com/en/pro-app/3.1/arcpy/sharing/mapservicedraft-class.htm#GUID-F39810A0-180C-4E9...
Starting backwards I saved an SD-file from ARCGIS Pro GUI, and then I could successfully publish this using (got the python command from geoprocessing tool)
arcpy.server.UploadServiceDefinition(
in_sd_file=r"C:\Users\...\out\TEST.sd",
in_server=r"C:\Users\...\server on ***.ags",
in_service_name="",
in_cluster="",
in_folder_type="FROM_SERVICE_DEFINITION",
in_folder="",
in_startupType="STARTED",
in_override="USE_DEFINITION",
in_my_contents="NO_SHARE_ONLINE",
in_public="PRIVATE",
in_organization="NO_SHARE_ORGANIZATION",
in_groups=None
)
This made me think that the server connection was alright?
But, then I started trying to create the SD-files from code, and the issue I'm getting is
ValueError: Target server is not a standalone server or is inaccessible.
on this step
sddraft.exportToSDDraft(sddraft_output_filename)
So, something wrong with my sddraft.targetServer?
Started pointing at the same .ags file as I had used in UploadServiceDefinition, and then I played around with numerous different urls, using info from components-of-arcgis-urls and connect-to-a-gis-server. Could not get it to work, and I'm not sure where to go to find the URL's.
Moving on I wanted to try if I could generate the SD draft in offline mode, hoping that since UploadServiceDefinition with the SD file generated from ArcGis Pro it would also succeed with uploading my offline-sd, but no can do. Exact same call as above, just another SD, I got
ERROR 002901: Sharing related error during geo-processing (Unable to check if service exists.
So back to "it's probably the connection, I just delayed the problem" I started investigating the publisher connection a little bit more.
I can find my Server manager page here
https://yyy.xyz.com/server/manager/index.html
If I go to manager/webadaptor I find this url
https://[machineName].ad.[zzz].eu/server
I think I've tried all combinations possible with these two urls and the info from links above and I just don't get it.
And then I found this video, and what I realized was that I'm not able to pass on username and password when I create a new connection, don't know why.
Last clue that I have is that I went to server manager and used the ui to upload my sd file generated from code (using offline-mode), which worked if I removed existing service first (event though I set override to true).
Does anyone have any idea what I'm doing wrong?
Update (still not working)
Created an offline draft from arcgis pro UI, and I can't publish this, exact same behavior as with code-generated one (win!).
However, in geoprocessing tool I played around with properties value and if I set "override service definition sharing properties to true" I see
Warning 001404 You are not signed in to ArcGIS Online.
But I am signed in to our portal in arcgis pro?
Next update (still not working #2)
Changed the upload command to use server-url (https://yyy.xyz.com/server/), now I can connect and publish my service however, only if it doesn't exit.
My takeaway from this is that "overrideExistingService" does not work with offline definition?
And the issue still persist - I don't know what I need to do to be able to create "online" sd 😞