You can use the PrintingTools service to print maps that contain secure services.
If your ArcGIS Server 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, 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.
If you secure your services using short-term tokens (the default), the user will be asked to provide the name and password upon 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 detail how to do so.
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 is federated with an ArcGIS Enterprise portal, printing maps with the PrintingTools service is supported by default with no additional steps needed. 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.
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.
To embed credentials in a custom print service from ArcGIS Pro, you can use the ImportCredentials function in ArcPy.