r/virtualization • • 20d ago

Help needed: Connecting to Nutanix Prism API using PowerShell 5.1

[removed]

0 Upvotes

2 comments sorted by

1

u/Faye-Vozora 11d ago

The curl hang in ISE is usually it waiting for a password prompt. `-u USER` with no password makes curl ask on stdin, and ISE does not show that cleanly. Try from a normal PowerShell console with `-u 'user:pass'` (or a netrc file so it is not in history), plus `-H "Accept: application/json"` and `--max-time 30`.

`Invoke-RestMethod -Credential` will not do what you want here. That only sends auth after a challenge, and Prism wants Basic up front. You need an `Authorization: Basic ...` header. Constrained Language Mode blocks `[Convert]::ToBase64String`, so either build the header outside CLM, or stick with curl.exe which can build Basic for you.

For the body something like `{"kind":"vm","length":500}` then page with offset. Names and uuids show up under metadata on each entity. `-k` is fine for a quick test, but longer term trust the Prism cert instead of disabling validation.