ZertoPublic / ZertoApiWrapper

PowerShell wrapper for Zerto Virtual Manager API
GNU General Public License v3.0
15 stars 12 forks source link

General authorization error #35

Closed g-pearl closed 5 years ago

g-pearl commented 5 years ago

I am using the default self signed certificate that comes with Zerto. Ran the connect-zertoserver -zertoserver -credential (Get-credential) and it succeeds but then any command that I run afterwards I get the following error.

Invoke-RestMethod : {"errorCode":50,"errorMessage":"General authorization error"} At C:\Program Files\WindowsPowerShell\Modules\ZertoApiWrapper\1.1.0.34\ZertoApiWrapper.psm1:45 char:13

What is the best way to resolve.

Thanks

wcarroll commented 5 years ago

Hi @g-pearl, What versions of Zerto and PowerShell are you running? Also, I am assuming that you use a variable or string for the -zertoserver parameter? If possible, can you please try to connect again and use the -return headers parameter and let me know the out put?

Command:

PS > Connect-ZertoServer -zertoserver "192.168.1.100" -credential (get-credential) -returnHeaders -verbose

If that is successful, try to run a command like Get-ZertoVpg

Should look like this: image

If this errors out, run PS > $error[0] | fl * -force and show me the output of that?

wcarroll commented 5 years ago

@g-pearl, I believe I have an idea as to what is happening. Any function noun that starts with ZA is specifically for Zerto Analytics and requires the Connect-ZertoAnalytics command.

Try running any other command where the noun does not start with ZA and it should work.

TODO: Update Zerto Analytics Rest Request to check and ensure the token exists before attempting to execute and throw an error if it does not.

g-pearl commented 5 years ago

You are correct it does appear to be the NOUN of ZA that was causing the issue. I was able to run several of the NON-ZA commands after connecting.

I do have an additional question. The reason that I want to connect with this module would be to adjust the site replication throttle at several times throughout the day. Is there a way to adjust this via the APIWrapper module.

Thanks

wcarroll commented 5 years ago

There is not currently an API endpoint in the Zerto Virtual Manager to update the bandwidth throttling setting. If you want to see an API endpoint for this, please feel free to submit a Feature Request on MyZerto.

g-pearl commented 5 years ago

Will do thanks.