An error occurred while saving the commentDan Ward commented
You might want to check out a project I just released; by itself it might not do everything you want but will get you a long way there:
Octopus Deploy Utilities allows you to export your Octo configuration using the REST API but also post-processes your data, doing the ID -> name lookups you are looking for. It does this by adding new properties to the JSON: for any *Id property it add a *Name. So for a Teams MemberUserIds it adds MemberUserNames with the user names. For projects it'll add ProjectGroupName, LifecycleName, IncludedLibraryVariableSetNames, ClonedFromProjectName. For variables it does that for the Scope Environment, etc. fields but also goes an extra step adding a Scope.Breadth property which aggregates all the individual Scope values, simplifying programmatic usage.
It does more than ID -> name lookups, though; for a project it'll add the actual deploy process configuration and project variable variable set along with the any included library variable sets. More notes about the post-processing are here:
That said, this project is only for exporting the data, not pushing it back up. But you can easily use this with your scripts: the oduobject alias pulls in all the data from an export into a single PowerShell object. You could then very easily parse through the config, filtering for the object you are looking for by name, then grab it's Id. This returns the Id of the UserRole named 'TestRole':
((oduobject).UserRoles | ? Name -eq 'TestRole').Id
Hope this helps!