Error converting value "GoogleCloudAccount" to type 'Octopus.Client.Model.VariableType'

Hi,

I’m writing simple PowerShell script to count number of sensitives used in each Project Group. To achieve this I use Octopus.Client.dll. Our projects use also Google Account variable type. When I execute statement:

$projectVariables = $repositoryForSpace.VariableSets.Get($project.VariableSetId)

exception is throw with message

Error converting value “GoogleCloudAccount” to type 'Octopus.Client.Model.VariableType

In source code GoogleAccount type is missing - OctopusClients/source/Octopus.Server.Client/Model/VariableType.cs at master · OctopusDeploy/OctopusClients · GitHub

Maybe this is bug or I do something wrong. Can I count number of sensitives in another way ?

Best
Piotr

Hey Piotr,

Thanks for reaching out and for all of the information. It looks like this might just be something that got missed along the way when Google accounts were added. I can reach out and see if we can get that added but that might not be as quick as you need.

You could alternatively do the same with the API. You would need to iterate to each project group, then each project within the group, then look at the variables and check the type and tally it up.

It looks like this script might be a good starting point to modify and use. If not that one, something in the repo itself might be a better starter point for you. Here is one for listing projects in project groups that you could modify as well.

Depending on your use-case, you would need to also account for variable sets attached to the projects as well (which I’m not entirely sure the Octopus.Client method would have done that either). There is a script that will find which projects use a variable set, which you can probably use in conjunction with some other logic if you want to go down that road.

Please let me know if that helps or if you have any questions.

Best,
Jeremy

1 Like

Hey Piotr,

I’ve spoken with our engineers about this and they had me create a GitHub issue for you to follow the progress on. Here it is if you’d like to: Octopus.Client does not support variable sets that have GoogleCloudAccount VariableType in them (error: Error converting value “GoogleCloudAccount” to type 'Octopus.Client.Model.VariableType) · Issue #8016 · OctopusDeploy/Issues · GitHub

I hope you have a great rest of your week!

Best,
Jeremy

1 Like

Hi @jeremy.miller,

It’s good to see you back.

Thanks for clarification and guides. Thanks you guides I finished script much faster.

Best
Piotr

1 Like

You’re very welcome! I’m glad to hear you got it working!

Best,
Jeremy

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