In the past, I was creating an automated workflow to set up a utility network and then publish it to an enterprise portal. While coding, I discovered that it’s not possible to add a utility network to a map in ArcGIS Pro via the Python API—it always results in a runtime error.
Additionally, the same issue occurs in the portal web environment: It’s not possible to add a utility network feature layer from the portal into a web map using the ArcGIS Python API. The issue seems to lie with the layer of type "Utility Network Layer"; the error message indicates that it doesn’t have a renderer attached yet.
After contacting support, I was informed that this functionality hasn’t been developed yet. Since this feature would be quite important for working with utility networks in an enterprise environment, it would be very helpful if this functionality could be introduced in the future.
Best regards!