In the process to publish a python tool, I came to the part of automate the deployment process. i start using python for it.
reading the documentation i found CreateGPSDDraft—ArcPy Functions | Documentation
as well as Upload Service Definition—Help | Documentation
The first function use a parameter connection_file_path ( A string that represents the path and file name to the ArcGIS Server connection file (.ags).)
The second function in the example 2 shows how to use the ags file for the connecttion.
How can I create the ags file using python in ArcGIS Pro?
Is it possible to make all this process publishing to an ArcGIS server having a user with proper rights and its password (no ags file)?