New-PveAccessUsersToken
Generate a new API token for a specific user. NOTE: returns API token value, which needs to be stored as it cannot be retrieved afterwards!
API: POST /access/users/{userid}/token/{tokenid}, Proxmox VE API viewer
Syntax
Section titled “Syntax”New-PveAccessUsersToken [-PveTicket <PveTicket>] [-Comment <string>] [-Expire <int>] [-Privsep <bool>] -Tokenid <string> -Userid <string> [<CommonParameters>]Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
-PveTicket |
PveTicket |
No | Ticket data connection. |
-Comment |
string |
No | |
-Expire |
int |
No | API token expiration date (seconds since epoch). ‘0’ means no expiration date. |
-Privsep |
bool |
No | Restrict API token privileges with separate ACLs (default), or give full privileges of corresponding user. |
-Tokenid |
string |
Yes | User-specific token identifier. |
-Userid |
string |
Yes | Full User ID, in the name@realm format. |
Every parameter also binds by property name from the pipeline, so an object with node and vmid properties (the output of Get-PveGuest, for one) fills -Node and -Vmid. Without -PveTicket the cmdlet uses the last connection, see Connection.
Output
Section titled “Output”A PveResponse: the data returned by Proxmox VE is in .Response.data, the outcome in .IsSuccessStatusCode. See Results and Errors.