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.
I faced the same question and found it in the docs.
Looking at the docs:
...you'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 = "https://MyFederatedServer.esri.com/server"
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?
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?
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.