PROBLEM
There is a limitation on ArcMap’s authentication for hosted imagery layers in an ArcGIS Online organization. If a user has signed into ArcGIS Online in ArcMap and is attempting to Add Data by searching for the item in ArcGIS Online, an extra ArcGIS Online dialog box displays that is not intended, and even if the user supplies the credentials again, it does not work.
This is unlikely to be fixed since Esri is no longer releasing ArcMap.
The workaround to add a dynamic imagery layer to ArcMap is to use the Make Image Server Layer tool with the image service URL and a token. For example: https://iservices.arcgis.com/gUR1YWXNyLOlL4Ys/arcgis/rest/services/release93_test1_di/ImageServer?token=<token>
Note: The token can be obtained using https://developers.arcgis.com/rest/users-groups-and-items/generate-token.htm or from the URL when viewing the REST URL of the hosted imagery layer.
Example:
arcpy.MakeImageServerLayer_management(in_image_service="https://iservices.arcgis.com/gUR1YWXNyLOlL4Ys/arcgis/rest/services/release93_test1_di/ImageServer?token=<generated token>", out_imageserver_layer="online_is_Layer")
Article ID: 000026687
Get help from ArcGIS experts
Download the Esri Support App