cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 12

Create Credentials via SWQL API using Invoke/Create

Is there a way to add a credential via the SWQL API?  If now, how can I do this via the SQL and what is the encryption I need to use to put the password in?

I would like to bulk add credentials for several nodes.  Each node has it's own credential information.

I am currently using the REST calls with Invoke / Create, so I know how to do that, but with Credentials, I need to add a password and SolarWinds needs to encrypt it.

Thanks,

Charles

0 Kudos
9 Replies
Level 19

Revisiting an old thread - we now have an API for this. Credential Management · solarwinds/OrionSDK Wiki · GitHub

I seem to have a bit of trouble using it in Python.  I'm stuck on passing the boolean values:

                credentialdetails = {

                        'name': row['host'],

                        'username': row['user'],

                        'context': None,

                        'authenticationMethod': TranslateAuth[row['auth']],

                        'authenticationPassword': row['rstring'],

                        'authenticationKeyIsPassword': 'True',

                        'privacyMethod': TranslatePriv[row['priv']],

                        'privacyPassword': row['wstring'],

                        'privacyKeyIsPassword': 'True',

                }

                snmpv3_credential_id = swis.invoke('Orion.Credential', 'CreateSNMPv3Credentials', *credentialdetails)

  

This gives me:

    raise HTTPError(http_error_msg, response=self)

requests.exceptions.HTTPError: 400 Client Error: Verb Orion.Credential.CreateSNMPv3Credentials cannot unpackage parameter 5 with type System.Boolean for url: https://ae-lsw-01.aenetad.net:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.Credential/Cr...

I've also tried passing True without the single-ticks, and it passes the same error.

0 Kudos

What product/version are you using?

0 Kudos

Orion 2017.3.5 SP5, NPM12.2.

Python 2.7.13

orionsdk-python 0.6 (grabbed it from github yesterday)

0 Kudos

Oh, I see what's happening here. SWIS verb parameters are positional, not named. Try this:

credentialdetails = [

   row['host'], # name

   row['user'], # username

   None, # context

   TranslateAuth[row['auth']], # authenticationMethod

   row['rstring'], # authenticationPassword

   'True', # authenticationKeyIsPassword

   TranslatePriv[row['priv']], # privacyMethod

   row['wstring'], # privacyPassword

   'True', # privacyKeyIsPassword

]

I wasn't sure what python would do if you pass a dict for a *args parameter, so I tried it. Result: you get a list of the dict's keys in random order. Not helpful!

0 Kudos

Thank you.  That's gotten me further.  Now I need to clean up unused credentials somehow.

0 Kudos
Level 19

We don't have an API for this yet.

0 Kudos

This would be a good api, as this information is what we already have in our CMDB and we need to get it over into SolarWinds as well.  This is duplicate effort.  Is there a way to do this via SQL?  I know it wouldn't be supported by SolarWinds, but I am willing to take the risk and work out any changes that may occur on upgrades.

Let's discuss this privately.

0 Kudos