I have a Python script that is run as a scheduled task every night. It updates a service definition on AGOL using arcpy.UploadServiceDefinition_server. When I first set this up, we had ArcMap 10.4 and Server 10.2. To get around needing to be signed in to ArcGIS Online, I would sign into AGOL through ArcMap and just never sign out. This got around the fact that arcpy.SignInToPortal_server no longer worked. Recently, we upgraded Server to 10.4, so that all versions are the same. Now, ArcMap automatically signs you out of AGOL every day, so when the script runs, it throws the error that you aren't signed in and the service definition never gets updated. Is there any work around to this? What is different about the Server being upgraded to 10.4 that made the change? Any help is appreciated.