I am trying to run powershell script (based on API) to monitor Netbackup Appliance without success. Using the same script on the ordinary Netbackup was ok. So, what could be the difference between the Netbackup Appliance and Netbackup?
Script to gather information about running services (https://github.com/VeritasOS/netbackup-api-code-samples/blob/master/recipes/powershell/admin/get_ser...)
The error output from Netbackup Appliance:
PS C:\Users\Administrator\Desktop> ./get_services.ps1 -MasterServer <hostname> -UserName <user_name> -Password <password> -Client <hostname>
Sending a POST request to login to the NetBackup webservices...
Sending a GET request to get host UUID ..
Invoke-WebRequest : Vzdálený server vrátil chybu: (401) Neověřeno.
At C:\Users\cz.jcieslar\Desktop\get_services.ps1:111 char:14
+ $response = Invoke-WebRequest `
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Unable to get host UUID.
At C:\Users\Administrator\Desktop\get_services.ps1:119 char:3
+ throw "Unable to get host UUID.`n"
+ CategoryInfo : OperationStopped: (Unable to get host UUID.
:String) , RuntimeException
+ FullyQualifiedErrorId : Unable to get host UUID.
It seems according to error (401),that our user has not enough priviliges to be able to gain UUID of the Appliance. However the login was successful, so the API token was generated without problem.
Do you have any idea how to increase user priviliges on the Netbackup Appliance? Do you have any experience with API powershell calls on the Netbackup Appliance?
I am looking forward for any suggestions!
Solved! Go to Solution.
The user authenticated also is required to have appropriate permission to perform the action. Check in RBAC whether the user you are authenticating also has permission to get the UUID.
Remember authentication is only one part - authorization to perform the action is also required.
In order to make API calls working for Veritas Netbackup Appliance it was needed to create another user:
Main_Menu > Manage > NetBackupCLI > Create UserName
And with this user it was possible to make working API call via powershell script. Moreover, it was possible to log in to WEBUI with this user as well.
Thank you for you contributions!