Deployment Permissions
This page explains how permissions work in Pulumi Deployments and how to configure them for your deployment needs.
INFO
This page mostly covers the actions your Deployment is allowed to perform within Pulumi Cloud, like opening an ESC environment. For the GitHub credential that deployments from a GitHub-connected source receive, see Version control credentials. To enable your Deployment to manage resources in your cloud, see Supplying Cloud Credentials to Pulumi Deployments
How a deployment's permissions are determined
Who a deployment runs as depends on the stack's Run as setting and on your organization's permission mode:
- A service principal or a team is selected. Every deployment runs as that service principal, or as the team's service principal, with exactly its permissions. It doesn't matter who or what starts the deployment.
- Nothing is selected, in a permissive organization. The permissions depend on how the deployment starts:
- If the deployment is created via the REST API or by using the Actions buttons in the Pulumi Cloud console, it is granted the permissions of the user that has executed the action.
- If a deployment is created because of a
git push, a pull request, or a schedule, it runs as the organization's background runner, limited to the stack's deployment role if one is set, and otherwise to the organization's default role.
- Nothing is selected, in a restricted organization. The deployment is refused. Every stack must select a service principal or a team.
- In the Free edition, deployments always run as the organization's single member.
The deployment's page shows the result, for example Runs as service principal deploy-prod or Runs as the person who triggered it.
Version control credentials
The Pulumi Cloud identity a deployment runs as is not the only credential it receives. When a deployment's source is connected through the Pulumi GitHub app, Pulumi also injects a GITHUB_TOKEN environment variable. This token is a GitHub App installation token with the installation's full scope, not a token limited to the source repository. It can reach every repository you granted the app and holds every permission the app holds, including write access to repository contents and workflows. Treat it as a broadly privileged credential. For the list of permissions and details on the token's lifetime, see GitHub token in deployments.
To give a deployment a narrower GitHub credential, set your own GITHUB_TOKEN in the stack's environment variables, for example a fine-grained personal access token limited to the repositories the deployment needs. A value you set always overrides the one Pulumi provides. If you configure the source with your own personal access token, Pulumi uses that token as GITHUB_TOKEN instead.
Granting additional permissions
The recommended way to control what a deployment can access is to run it as a service principal:
- Create a service principal, with no organization-wide role if the deployment only needs a few stacks and environments.
- Give it Stack Write on the stack, Stack Read on any stacks whose stack references the program reads, and Environment Open on any environments the stack uses, including environments imported transitively. Grant these on each stack's and environment's access settings, or through a role.
- On the stack's Settings → Deploy page, select it under Run as, then select Save.
To manage organization resources such as teams, members, or OIDC issuers from a deployment, give the service principal a role that includes those permissions.
In permissive organizations, two older options remain:
- A deployment role. Choose a role under Run as to limit automatic runs to that role's permissions. Deployment roles are being deprecated, so prefer a service principal or a team.
- A
PULUMI_ACCESS_TOKENenvironment variable in the stack's deployment settings, set to an individual, team, or organization token. The deployment gets the permissions associated with the token, regardless of how it was created (REST API,git push, etc.). This can't be combined with a service principal or a team, and isn't available in restricted organizations.
Minimum required token permissions
If using an individual or team token, the token must have at minimum:
WRITEaccess to the stack that is being deployedREADaccess to any stacks from which Stack References are being usedOPENaccess to any ESC environment that is listed in the stack's configuration file, including any environments that are imported transitively
Using ESC with Deployments
For enhanced security and simplified credential management, we recommend configuring your stack to use Pulumi ESC for cloud credentials and ensuring the Deployment runs as an appropriately scoped service principal.
This approach offers several advantages:
- Dynamic, short-lived credentials instead of long-lived static credentials
- Fine-grained control over credential scope and permissions
- Centralized credential management
- Reduced risk of credential exposure
- Complete audit trail of credential usage
Configuring ESC for Deployments
- Create an ESC environment with the appropriate cloud provider credentials
- Reference this environment in your Pulumi stack configuration
- Give the service principal the stack's deployments run as Environment Open on the environment, as described in Granting additional permissions
For more information on setting up ESC environments, see the ESC documentation.
You can use ESC with pre-run commands in Deployments by prefixing each command with pulumi env run. For example:
pulumi env run my-aws-env -- aws s3 lsThis executes the aws s3 ls command with credentials from your my-aws-env ESC environment.