Forum Discussion
Powershell: Invoke-RESTmethod on /mgmt/tm/sys/ucs (403) Forbidden error
I have not tried another account as this is my account, but I could potentially create an account just for this. However, my account is an admin, and it does let me authenticate via the API to do a GET request and get a list of the UCS archives already on the appliance, for which there is one. And there is no name collision. This is from F5's documentation:
<POST> /mgmt/tm/sys/ucs -d '{"command":"save","name":"/var/local/ucs/test_ucs.ucs"}'
However, in another document somewhere else they only provide the filename with no full path, and no file extension. I've tried all of those combos with the same result.
Maybe I have not been clear enough : the credential are fine, I mean the filename :
You have a 403 for "/var/local/ucs/test_ucs.ucs", have you tried "/var/local/ucs/test_ucs_XXX.ucs" ?
Cheers,
Sam
- KeyClackerMar 01, 2022Altocumulus
Thanks Sam. I have tried that. I've tried:
/var/local/ucs/test_ucs.ucs
/var/local/ucs/test_ucs123.ucs
/var/local/ucs/test_ucs123
test_ucs
test_ucs123
all produce the same error message. I'm currently attempting to combine some methodology from the POSH-LTM-Rest module found here and the code i've been working on already. The documentation doesn't call it out anywhere but I wonder if you have to retrieve an F5 session token before you can do anything using the POST method.
- SamCoMar 01, 2022Cirrus
Looking at this article, it looks like people manage to make it with standard credential :
Good luck 😉
- KeyClackerMar 01, 2022Altocumulus
So this is the example syntax that i've been going on (from that thread and documentation):
curl -v -sk -u admin:admin https://10.10.10.10/mgmt/tm/sys/ucs -H "Content-Type: application/json" -X POST -d '{"command":"save","name":"test.ucs"}'
I'm on a Windows box though, and something about that doesn't translate well to Curl.exe. It gets mad about non-json content. So, I spun up a Linux VM really quick and ran that exact syntax and it didn't error out AND it created a test.ucs. Now I just need to understand what's different between that curl request and what i'm doing with Invoke-RestMethod in Powershell, because I'm not seeing it.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com