p0 grant
Overview
The p0 grant command lets you request on behalf of another principal for a principal (user, service account, or group) to a specific resource in your organization’s platforms—AWS, Azure AD, GCP, Kubernetes, Okta, PostgreSQL, Snowflake, SSH, and Google Workspace. Unlike p0 allow (which sets up standing access), p0 grant issues ephemeral access requests that:
Trigger the provisioning workflow in the target system
Optionally wait until the request is approved or denied
Report the outcome and exit with a status code
Use p0 grant when another user needs just-in-time access for troubleshooting, one-off tasks, short-lived sessions, or for NHI identities
Prerequisites
Logged-in user
If you’re not logged in or your token expired, p0 grant will prompt you to authenticate.
Tenant configuration
Confirm ~/.p0/config.json has the correct appUrl for your P0 tenant.
Network access
Ensure HTTPS egress to https://<your-tenant>/o/<org-slug>/command/.
Syntax
<provider>
One of:
<subcommand> & resource args
Vary by provider (see “Examples” or run p0 grant <provider> --help)
--to <principal>Required. Email or service-account identifier to receive access
--duration <duration>The requested duration of access (e.g.
4 hours,1 day)--reason <text>(Optional) Justification for audit logs
-w, --wait(Optional) Block until the request is approved/denied (up to 5 minutes)
--helpShow provider-specific subcommands and options
Duration formats:
Human-friendly strings such as 10 minutes, 2 hours, 5 days, 1 week.
Supported Providers
For detailed resource arguments per provider, append --help:
Examples
AWS: Ephemeral IAM Policy on a Resource
Subcommand: resource <ARN> <policy…>
Account: AWS account ID
Outcome: Alice can assume ReadOnlyAccess on my-bucket/* for up to 1 day.
GCP: One-Time IAM Role
Subcommand: role <role-name>
Project: GCP project ID
Outcome: Bob gains the viewer role on my-gcp-project for 12 hours.
SSH: Temporary Group Membership
Subcommand: group --name <group-name>
Outcome: Charlie is added to the SSH access group devs for 4 hours.
Last updated