Hi all,Long time lurker, first time poster...I recently got into provisioning various JSON services over Powershell and have been (overall) successful. The only one that keeps alluding me is ProxMox.
So far, I have my Proxmox test machine assigning me a ticket just fine. The data returned is
:ticket : PVE:jason@pam:5583228E::1lQfDndlTzQIAdg7lj8l5Mg........==
CSRFPreventionToken : 5583228E:N9yJ+Xz/X4QZzVNIPD//F2Bhdw0
username : jason@pam
I have successfully created a session cookie with these values, and have stored them in the session variable $proxmox.Cookies. However, whenever I want to grab the basic JSON API and pass the cookie, I get a 401 Unauthorized.
Interestingly, syslog and daemon.log show a 'successful auth for user jason@pam' every time I try to get the JSON files.
The command I run is:
I have tried several ways of creating the cookie, even just adding the ticket and CSRFPreventionToken directly into the headers.
See a slightly sanitized version of my script (so far) attached. I am hoping to turn this into a useful Cmdlet over time, that I will gladly share with the community.Any ideas or assistance is very welcomed!
Thanks,Cas
So far, I have my Proxmox test machine assigning me a ticket just fine. The data returned is
:ticket : PVE:jason@pam:5583228E::1lQfDndlTzQIAdg7lj8l5Mg........==
CSRFPreventionToken : 5583228E:N9yJ+Xz/X4QZzVNIPD//F2Bhdw0
username : jason@pam
I have successfully created a session cookie with these values, and have stored them in the session variable $proxmox.Cookies. However, whenever I want to grab the basic JSON API and pass the cookie, I get a 401 Unauthorized.
Interestingly, syslog and daemon.log show a 'successful auth for user jason@pam' every time I try to get the JSON files.
The command I run is:
Code:
Invoke-RestMethod https://proxmox.home.mollien.net:8006/api2/json' -SessionVariable $proxmox -Verbose
See a slightly sanitized version of my script (so far) attached. I am hoping to turn this into a useful Cmdlet over time, that I will gladly share with the community.Any ideas or assistance is very welcomed!
Thanks,Cas
Last edited: