.NET API nuget runbooks getting 404

When using the .NET API in the Octopus nuget we can’t seem to run a published runbook with only ‘runbook consumer’ permissions. This results in getting a 404 when following the example given in the Octopus documentation (C# version).

It appears, compared to testing with direct REST API calls, that the example given above assumes the ability to get the Runbook template. But that appears to require ‘Runbook producer’ permissions, in order to edit/publish the runbook. But there does not appear to be any other way to get a ‘DeploymentPromotionTarget’. That, only comes from ‘PromotTo’ in the template.

Is there a way to create an appropriate ‘DeploymentPromotionTarget’ object to use to run the published runbook, without getting a template object first.

Hey David,

Thanks for reaching out.

Are you copy-pasting the entire PowerShell script into your PowerShell console or have you modified it in some way?

I tested out the REST API script with a service account that only had Runbook Consumer role and it worked for me on version 2021.2.7293.

Which version are you currently running where you are getting a permissions issue?
Can I please get more information regarding DeploymentPromotionTarget? I am not seeing that in the script, nor any logic for promoting or editing a runbook.

Please let me know.

Best,
Jeremy

I’m not using the PowerShell version, I’m using the C# version. The PowerShell one works fine, but the issue arises when using the Octopus nuget with the .NET API library.

Note, that in the PowerShell version, there is no call to anything ‘***Template’, whereas in the C# version it gets ‘template’ data. That ‘template’ data is the part that we trip over in the C# version.

Also, regarding ‘promoting’, it’s a bit confusing. The C# code in the example, and in our code, doesn’t actually ‘promote’ anything. ‘PromoteTo’ is the property that has to be used in order to get the DeploymentPromotionTarget.

Hi David,

Sorry about the confusion.

Would you mind please sending me the entire C# script with your API key removed so i can have an apples to apples test while I reproduce the issue on my end? You can DM it to me if you’d like.

Please let me know if that’s something you’re okay with.

Best,
Jeremy

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.