I have been given a task to identify how many machines are used in octopus as Deployment target in respect to all Projects.
Suppose we have 3 Projects : Project-A, Project-B and Project-C
All three projects have 3 environments : Dev, QA, PROD
Each Environment of a project has deployment machines : Server 1, Server 2 and Server 3 (total 9 Machines)
I want to extract this data so that we can identify how many machines are been used in Dev environment under Project A
Currently we have almost 1100 deployment targets and more than 50 environments
Thanks for getting in touch, and we appreciate the kind words! It’s always great to hear that Octopus has provided value.
I had a look in our sample script repo and found one that looks to be very close to what you’re after.
I imagine you may want to tweak that to filter machines only in the Dev environment, but I’m curious to hear how close the data returned in that script is to what you need.
Thanks for following up! I can’t see the reason why a 404 would be thrown at that point, unfortunately, as it looks to simply be in the foreach loop making a request to the current project. You can test it against the https://samples.octopus.app cloud instance using the api key API-GUEST, and that seemed to have run as expected in my identical test. Does that work for you?