Forum Discussion

JimmyB2's avatar
JimmyB2
Level 4
3 years ago

Netbackup Appliance API calls not working

Hi all,

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_services.ps1)

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...

Login successful.

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
eption
+ 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!

  • StefanosM's avatar
    StefanosM
    3 years ago

    I think that admin user does not have access to web UI. And as webUI is 100% API calls, I imagine that the user can not do what you want.

    Create another user from the clich, give him the right permissions from the webui and test your scripts

3 Replies

  • Hi JimmyB2 

    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.

    Cheers
    David

    • StefanosM's avatar
      StefanosM
      Level 6

      I think that admin user does not have access to web UI. And as webUI is 100% API calls, I imagine that the user can not do what you want.

      Create another user from the clich, give him the right permissions from the webui and test your scripts

      • JimmyB2's avatar
        JimmyB2
        Level 4

        Hi StefanosM and davidmoline 

        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!