Hello @Nadiia_Matsiuk
I understand what @gahe mentioned is totally workable solution. However, ArcGIS Enterprise makes it easier by allowing you publish this without the need of Utilizing the Desktop client.
ArcGIS Server comes inbuilt to a utility named "Publish routing services command line utility" but there are some points you would need to keep in mind :
- To use this utility, your ArcGIS Server site needs to have an ArcGIS Network Analyst extension license.
- If your ArcGIS StreetMap Premium data is licensed, you need to install the appropriate data license on each machine before running this utility.
Additionally, kindly find a few link below for more understanding:
This Utility takes care of everything from Enterprise perspective, some mentioned below:
- The service published can be used to perform route, closest facility, service area, location-allocation, origin destination cost matrix, or vehicle routing problem analyses on transportation networks.
- If the ArcGIS Server site is federated with a portal, the services are configured as utility services with your portal. Once published, the services can be used in client applications such as ArcGIS Pro or the Map Viewer Classic of the ArcGIS Enterprise portal to get directions and perform analysis.
Note: All the documentation links are 11.2. Do switch the version as per your requirement as per the version you are working with
Hope this helps.