It would be useful to have a Python function to return a list of Groups that an ArcGIS Server map service or Portal content is shared with. Similar to the item.access function, but it would return a list of Groups shared with. When used in a Python script it could be placed in a loop to list or write to CSV file the sharing properties of all services/content. This would be very helpful in situations where you need to produce a report showing how Sharing for Groups is set up for all map services and Portal content, or if you need to set sharing the same way on another server.
In our case, we need to know how map services are currently shared because we are going to refederate, and refederating sets everything back to “Not Shared”. So it would be useful to have a python script that could list all sharing settings, so I could refer to this output when resetting the Sharing after refederating. We could also use this to copy sharing settings from one server and apply them to another server.
A second Python function to set or import Sharing would also be helpful. Combined, they would allow you to create Python scripts that would export sharing settings from one configuration, and import them into another. Between the export and import, the GIS Administrator could make any necessary changes to the CSV file and then use the import Sharing function to apply those settings.