arcpy missing target server

07-14-2019 10:11 PM
New Contributor III

when I use this sharing_draft = m.getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE", service) I get an error missing target server. 

I'e signed in using my /portal url and my federated server is on a /server GIS site url. There is no-where to tell it the name of the target sever or url

thoughts? Trying to publish a Pro project file as a federated map image through code.

0 Kudos
7 Replies
Occasional Contributor

i also have this same issue

0 Kudos
by Anonymous User
Not applicable


I faced the same question and found it in the docs.

Looking at the docs:

MapImageSharingDraft—Sharing module | Documentation'll need to add the 'federatedServerUrl' property to the 'MapImageSharingDraft' object.

(from the Code Sample on the same page...)

sharing_draft = m.getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE", service)
sharing_draft.federatedServerUrl = "" 
Occasional Contributor


Our portal (ArcGIS 10.7.1) and thus the federated server is secured with Web-Tier Authentication (Apache Tomcat and the Java WebAdapter) with LDAP (Basic-Auth).

In my case, calling the exportToSDDRAFT function after specifying the federatedServerUrl fails with the error:
Exception has occurred: ValueError
Target server is not a federated server or is inaccessible.


How can I hand over authentication params to the arcpy function to finally generate a *.sddraft or *.sd file?

sharing_draft = m.getWebLayerSharingDraft("FEDERATED_SERVER""MAP_IMAGE", service)
sharing_draft.federatedServerUrl = ""
sharing_draft.summary = "My Summary"
sharing_draft.tags = "My Tags"
sharing_draft.description = "My Description"
sharing_draft.credits = "My Credits"
sharing_draft.useLimitations = "My Use Limitations"

# Create Service Definition Draft file
0 Kudos
New Contributor

I am having the same issue as LorenzMeyer1. In my case, the commands execute and I am able to complete publishing when I am using the python window in ArcPro. In a script however, the 'exportToSDDraft' command fails with the error:

'ValueError:Target server is not a federated server or is inaccessible'

Has anyone run across a solution? 

Thank you

Occasional Contributor

Hi @Abby_Gleason ,
I am having the same issue. Did you manage to find a solution?
I can publish from ArcGIS Pro, but get the error when running an external script.

Thanks for any help

0 Kudos
Occasional Contributor III

I ran into this issue today. Apparently, the "federated_server_url" is pretty picky with which URL you use. Go to the Portal Admin Directory and go to your federation page (Home > Federation > Servers > your server). Then, use the URL listed in the "Url" parameter on that page as the "federated_server_url" parameter in your script. That fixed my issue.

by Anonymous User
Not applicable

if I were you, I probably would test manual publishing with ArcGIS Pro with the same credentials and federate server first, trying to isolate the settings from portal site

0 Kudos