You can use the PrintingTools service to print maps that contain secured services.
Web-tier authentication
If your ArcGIS Server site is federated with an ArcGIS Enterprise portal and only the portal's ArcGIS Web Adaptor uses web-tier authentication (IWA, PKI, Basic, and so on), printing secured services will work as expected. The same is true for deployments that do not use web-tier authentication systems.
However, if your ArcGIS Server site's Web Adaptor uses web-tier authentication and is not federated, the PrintingTools service and custom print services will not be able to print any of your site's services. This restriction exists for both federated and stand-alone ArcGIS Server sites.
Short-term tokens
If you secure your services using short-term tokens (the default), the user will be asked to provide the name and password on opening the web app. The token is then passed to the PrintingTools service when the user requests a map to be printed.
Embed credentials into a service
In some cases, when publishing your own print service that contains secured services, you need to embed credentials into the print service that it can use when requesting maps from the secured services. The steps at the end of this section explain how to do this.
If you embed a long-term token in your web app code, the authentication information cannot be passed to the PrintingTools service. Regardless of your server configuration, you need to embed credentials into the print service using the steps below.
If you enforce security at the web server tier, and your ArcGIS Server site is federated with an ArcGIS Enterprise portal, printing maps with the PrintingTools service is supported by default with no additional steps required. However, if you have a stand-alone installation of ArcGIS Server and you enforce security at the web server tier, you need to embed credentials using the steps below.
Caution:
It is not recommended to embed credentials in a custom print service without fully understanding the security impact. If you choose to publish your own service for printing with embedded credentials, it's recommended that you apply ArcGIS Server security rules to restrict who can access the service. This prevents anonymous users from generating printable map images that display your secured services. See Control access to your services to learn more about setting up security.
Note:
These steps are only available when preparing a print service to be published from ArcMap. To embed credentials in a custom print service from ArcGIS Pro, you can use the ImportCredentials function in ArcPy.
- In the Catalog window of ArcMap, click Toolboxes > My Toolboxes.
- Right-click My Toolboxes, click New, and click Toolbox.
- Give your toolbox a name, such as SecurePrinting.tbx.
- In the Catalog tree, expand Toolboxes > System Toolboxes > Server Tools.tbx > Printing.
- Right-click the Export Web Map tool and click Copy.
- Right-click the toolbox you created in step 2 and click Paste.
- Right-click the pasted Export Web Map tool from your own toolbox and click Edit.
- Click the add button and browse to the GIS server connection that contains the secured services you want to print.
The connection must have the name and password saved with it. It should be a user connection, not a publisher or administrative connection.
If you don't see any available connections, return to the Catalog tree and make one using the instructions in Connect to ArcGIS Server from ArcGIS Desktop.
- Publish the Export Web Map tool from your own toolbox as a geoprocessing service using the steps in Tutorial: Publish additional services for printing. In step 2 of the tutorial, open the Export Web Map tool you pasted in the steps above. Do not open the original Export Web Map tool from the Server Tools toolbox.