vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 89 forks source link

Can't document NSX 6.3 firewall rules using DFW2Excel.ps1. Error "Unable to retreive role details from NSX. Invoke-NsxRestMethod : The NSX API response received indicates a failure. 400 : Bad Request : Response Body: <?xml version="1.0" encoding="UTF-8"?>" #531

Closed Crypto-Gi closed 6 years ago

Crypto-Gi commented 6 years ago

I am new to powernsx , I followed the instruction to connect to vcenter and nsx using sso credentials as below. PS /> Connect-NsxServer -vCenterServer vc-01a.corp.local

Entered the SSO credential's and can retrieve the range of different information from powercli. But I tried documenting DFW rules and it throws the following error.

Does anyone knows what's going or what I am doing wrong. edit123

alagoutte commented 6 years ago

Hi,

Do you have with administrator account ?

Do you have check if the user have NSX privilege ?

Crypto-Gi commented 6 years ago

I use my account to access vcenter and configure all nsx policies . If it does not have nsx privilege then probably I could not do all those tasks. Is there anyway I could check form vcenter.

Crypto-Gi commented 6 years ago

I just checked its Enterprise Admin Privilege

alagoutte commented 6 years ago

can you try Get-NsxRole cmdlets ?

May be also need to use directly nsx-powerops tools (may be a update with a fix for this issue)

Crypto-Gi commented 6 years ago

PS C:\Users\xyzr\Documents\WindowsPowerShell\Scripts> Get-NsxRole Get-NsxRole : The term 'Get-NsxRole' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Crypto-Gi commented 6 years ago

capture_123

Crypto-Gi commented 6 years ago

I used the same user details to create visio diagrama nd to capture the data, it works like a charm . But not this script...

alagoutte commented 6 years ago

Sorry, it is a get-nsxuserrole

and for last error message, it is say, we need to use the local NSX Manager Account (super_user role access...)

Crypto-Gi commented 6 years ago

I got it, my question is there anyway to make it work with current account. It has enterprise admin access.

I hope there is way around :(

alagoutte commented 6 years ago

it is a nsx-powerops issue, need to ask directly on nsx-powerops

for a quick look of code, coming for call a function (Get-NsxManagerSystemSummary) need super_user role access may be can be change.. There is a PR for look enhance this https://github.com/vmware/nsx-powerops/pull/61

Crypto-Gi commented 6 years ago

Hey it works , thanks for the guidance. I really appreciate it.

Crypto-Gi commented 6 years ago

here is a PR for look enhance this vmware/nsx-powerops#61

alagoutte commented 6 years ago

i think, it will be possible to make a small fix and i will be more easy to merge...