UpdateCredential
API token
I have the same questionI looked at the documentation here: Documentation: https://github.com/solarwinds/OrionSDK/wiki/Credential-Management
# Connect to the SolarWinds server$hostname = ""$username = ""$password = ""$swis = Connect-Swis -Soap12 https://$hostname/swvm/services/InformationService -Username $username -Password $password -IgnoreSslErrors$bearer_token_credset = ""$bearer_token_desc = ""$bearer_token = ""$properties = [System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]]::new()$properties.Add("Name", $bearer_token_credset);$properties.Add("Description", $bearer_token_desc);$properties.Add("Token", $bearer_token);# Define the parameters for the UpdateCredential function$CredentialID = 201# Call the UpdateCredential functionInvoke-SwisVerb $swis Orion.Credential UpdateCredentials @($CredentialID, $properties)
But it's giving me this error:
I figured it out! I wasn't connecting properly!
#Documentation: https://github.com/solarwinds/OrionSDK/wiki/Credential-Management# Connect to the SolarWinds server$hostname = "{Enter server name}"$username = "{enter username}"$password = "{enter your password}"$secPassword = ConvertTo-SecureString $password -AsPlainText -Force$creds = New-Object System.Management.Automation.PSCredential ($username, $secPassword)$swis = Connect-Swis -Credential $creds -Hostname $hostname # create a SWIS connection object$bearer_token_credset = "{enter name of the stored credential}"$bearer_token_desc = ""$bearer_token = "{enter your token}"$properties = [System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]]::new()$properties.Add("Name", $bearer_token_credset);$properties.Add("Description", $bearer_token_desc);$properties.Add("Token", $bearer_token);# Define the parameters for the UpdateCredential function$CredentialID = {enter the id of saved credential} #int value#you can find the ID of your saved credential in swql studio w/ this query:##-----------------------------------------------##SELECT ID, Name#FROM Orion.Credential#WHERE Name LIKE '%{enter credential name}%'##-----------------------------------------------## Call the UpdateCredential functionInvoke-SwisVerb $swis Orion.Credential UpdateCredentials @($CredentialID, $properties)