PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

AZ-401: GitHub Apps Workflow Tokens and Personal Access Tokens

Acquire an App installation token, compare workflow-token permissions, and create, test and delete a compatible user PAT while verifying actor, access and lifecycle boundaries.

Guide

Content version 1.0

AZ-401: GitHub Apps Workflow Tokens and Personal Access Tokens

AZ-401: GitHub Apps Workflow Tokens and Personal Access Tokens

Choose an authentication path by the actor that should perform the operation, then constrain its resource access and lifetime. A GitHub App uses a JSON Web Token (JWT) when acting as the App and an installation access token when acting as an installation. A workflow uses its job-provided GITHUB_TOKEN with effective workflow/job permissions. A personal access token (PAT) acts for its user and cannot grant access that user lacks.

The three procedures below acquire and use an installation token, configure and compare workflow-token permissions, and create, use and delete a compatible user PAT. They require an existing authorized sandbox and validated clients; they do not register an App, construct JWTs or invent application programming interface (API) endpoints. These are unexecuted procedures with expected observations, not reports of successful token use.

Establish the actor and the real operational inputs

Use the existing project and repository access established through AZ-401: Project Repository and Team Access Boundaries. Record the resource owner, selected private test repository, operator authority, disposable fixtures and restoration owner before requesting a credential.

Path Credential used for the selected operation Attribution to verify
App installation Installation access token acquired using the existing App's valid JWT The installed App, rather than an operator's personal account
Existing workflow job Its supplied GITHUB_TOKEN under effective permissions The workflow's automation context, rather than an assumed personal credential
User operation A compatible PAT with limited resources and permissions The PAT's user, further constrained by the token and organization policy

A JWT is not interchangeable with an installation token. Likewise, the user who initiates a workflow does not turn its job token into that user's PAT.

Have the owners supply these actual inputs:

  • An existing authorized App installation, its identifiers and approved repository/permission baseline, plus a valid pre-provisioned JWT.
  • An existing owner-authorized, validated integration client that can select that installation, obtain and use an installation token, expose useful expiry and actor/access evidence, and clean up its owned fixture.
  • An existing trusted workflow job with a validated operation client that consumes the job token without a personal-token fallback. It must support listing commits and adding a comment to an approved test issue.
  • A user authorized for the chosen private repository, permission to create a compatible PAT, and an isolated Git credential context for the PAT test.

Validate the clients' real supported operations before starting. If the installation client cannot perform the exchange or expose the required evidence, stop and obtain that validated input. Possession of a JWT alone does not establish a working exchange client. Do not guess an endpoint, method name or client control to bridge that gap.

Record identifiers and configuration evidence, not token values. Use protected credential inputs and approved secret storage. Automatic log redaction is not guaranteed; do not print a token, export it into an artifact or embed it in a repository address.

Acquire and use an installation token

This procedure starts at the validated integration interface boundary. The existing JWT and the client's supported exchange operation are prerequisites; JWT signing and new App registration are outside the exercise.

  1. Select the installation. In the real validated client, select the approved App installation and target resource. Compare the installation and repository with the owner's baseline. An installation for another account is not an equivalent test.
  2. Supply the App credential. Provide the valid pre-provisioned JWT through the client's protected input for App authentication. Confirm that the selected credential is the App JWT, without recording its secret value.
  3. Perform token acquisition. Invoke the client's validated installation-token acquisition operation for that installation. Inspect the actual result. A rejected JWT, unavailable installation or failed exchange is a failed prerequisite, not a token that can be used later.
  4. Record the issued credential's boundary. Retain the installation identifier, intended resources, relevant granted permissions and returned expiry evidence. Store the installation token only through the approved protected mechanism. Do not infer broader access from acquisition success.
  5. Use the installation token. Select that issued token for one owner-approved operation on a disposable fixture. For example, use an already validated test-comment operation where the installation has the required access. Do not substitute a user token when the operation fails.
  6. Verify operation and actor separately. Record the actual resource, result and observable App attribution through the client's supported evidence and any resulting activity. A local “request sent” message proves neither completion nor attribution. If the interface cannot expose the required actor/access evidence, stop rather than claiming the test passed.
  7. Exercise replacement deliberately. Before the recorded expiry, use a still-valid owner-supplied App JWT and the same validated exchange path to obtain a replacement token. Verify the replacement with the same bounded operation, then retire the exercise's old stored value according to the owner's procedure. Do not infer that requesting a replacement automatically invalidated the old value.

If acquisition or use fails, compare the actual expiry, installation selection, approved grants and resource with the baseline before requesting more access. An expired App JWT needs a new valid pre-provisioned input; this is not permission to add signing code. Loss of installation access also cannot be repaired by silently switching the actor to a user.

Remove only the exercise-created fixture and issued token copies through the supported owner-approved cleanup. Preserve the shared App registration, installation and key material. If an expiry or access-loss case cannot be safely exercised, record that limit rather than manufacturing a rejection result.

Configure GITHUB_TOKEN and compare permitted and denied access

Use a trusted, owner-authorized manual run of the existing workflow. Review the actual event, repository policy, runner and operation client before supplying the job token. Untrusted pull-request code is not an appropriate place to test privileged access.

The YAML Ain't Markup Language (YAML) fragment below changes permission configuration for an existing validated job, here named permission_probe. Retain that job's actual runner and reviewed operation steps; this fragment alone is not a runnable workflow.

permissions:
  contents: read
  issues: read

jobs:
  permission_probe:
    permissions:
      contents: read
      issues: write

The workflow establishes a restricted baseline and the job explicitly requests the permissions used by its probes. When permissions are specified, unspecified permission categories become none. The effective result also depends on enterprise, organization and repository defaults and the event's restrictions. Forked pull-request runs normally reduce write permissions unless the relevant administrator setting permits them; do not enable that exception for this exercise.

Perform the comparison using the already validated job client:

  1. Save the owner-approved permission change and record the exact workflow revision and event.
  2. Supply only that job's GITHUB_TOKEN through its supported protected credential input. Confirm that no stored PAT or App token can supply fallback authorization.
  3. Run the supported commit-listing operation for the selected repository. Contents read access is intended to permit this operation; inspect the actual result.
  4. Run the supported test-issue comment operation. Issues write access is intended to permit commenting where the effective policy and resource conditions allow it. Record the actual comment and automation context.
  5. Change only the job's Issues permission from write to read, retaining Contents read and the same client, resource and fixture. Start a fresh authorized run.
  6. Repeat both operations. Commit listing should remain permitted, while adding a new comment should be denied without the required write access. Record the real failure and confirm that no unexpected comment was created.

A failure of both operations is not sufficient proof of a useful permission boundary: the token might be unavailable, the repository wrong, or the client broken. A successful comment under the restricted case requires investigation of the effective configuration and credential selection; do not label it an expected denial.

Afterward, restore the original workflow configuration and remove only the test comments through the authorized fixture owner. Do not save GITHUB_TOKEN as a long-lived repository secret or reuse a previous job's value as a permanent integration credential. Use the job-supplied credential for the actual run and retain only nonsensitive evidence.

Create, use and delete a compatible user PAT

Select the token type for the actual operation before creating it. Fine-grained PATs support narrower owner, repository and permission selection, but are not universally compatible. Current limitations include Packages and certain collaborator or multi-organization scenarios. A classic PAT is not a harmless substitute: its scopes and organization policy still require review.

For this bounded read test, choose an authorized private sandbox repository whose ownership and user relationship support a fine-grained PAT. If that condition fails, resolve a compatible approved path before proceeding rather than widening the token.

Create and obtain any required approval

In GitHub Settings, open Developer settings, then Personal access tokens and Fine-grained tokens. Generate a new token with an identifiable exercise name and a short policy-compliant expiry.

Select the actual Resource owner, restrict Repository access to the approved repository, and select only the permissions required for the read operation. Keep unrelated permissions ungranted. Record the resource and permission choices without copying the secret into the evidence.

If the organization requires approval, provide the required justification and wait for an authorized administrator's review. A pending fine-grained token can read public resources but has not established the required private-repository access. Do not interpret public access as approval. Generate and handle the token through the approved secure process.

Use a fresh, isolated authentication context

Use Git over Hypertext Transfer Protocol Secure (HTTPS) with the private repository address supplied by its owner. In an approved isolated credential context, the documented clone interaction accepts the username and the PAT in place of a password.

The following illustrative command uses an owner-supplied nonsensitive repository address; it contains no token:

git clone "$PRIVATE_SANDBOX_REMOTE"

Use the environment-variable syntax appropriate to the actual shell, an owned empty parent directory and the approved credential prompt. Never insert the PAT into the address. Confirm that an existing credential manager, another token or anonymous public access cannot satisfy the request instead.

Inspect the actual clone result and selected repository. Record the tested user, token identity/name, owner, repository, permissions, expiry and approval state. A PAT does not increase its user's access; a later loss of that access can make the token unusable even before its chosen expiry.

Delete and verify rejection

Return to the matching token list in Developer settings and delete the exercise token. Then attempt a new authenticated request for the same private repository in a fresh owned location, explicitly selecting the deleted credential and excluding cached or alternative credentials.

Expected evidence is rejection of that new authentication attempt, not a successful public read or an error because the destination directory already exists. Do not print the rejected token to prove which value was selected. Retain the credential-selection and failure evidence through the approved client, then remove the exercise's remaining protected token copy.

If access unexpectedly succeeds, stop and investigate credential fallback, target privacy and whether the correct token was deleted. Do not repeatedly broaden scopes. Remove only the owned clone and exercise credential records under the agreed cleanup process; preserve unrelated credentials and repositories.

For a continuing integration, create a compatible replacement with only the needed access, test it on the selected resource, update its approved dependent clients, then delete the retired token. Record actual replacement and rejection observations instead of assuming that changing a label rotated a credential.

Keep Azure DevOps PAT governance separate

GitHub App, workflow and user credentials are not Azure DevOps credentials. In Azure DevOps, PAT access remains constrained by its owner, organization policy and resource permissions. Feature access levels and effective operation permissions are also distinct.

Prefer supported Microsoft Entra authentication for applications and automation. Where a tool cannot use it, use an organization-scoped Azure DevOps PAT with minimum scopes and a short practical lifetime. Existing global Azure DevOps Services PATs stop working on January 27, 2027. That published retirement does not mean every organization-scoped PAT or GitHub PAT is retired on that date.

Inventory dependent clients before replacement, verify the new credential on a bounded operation, update those dependencies and revoke the retired value. Unexpected failure needs status, expiry, policy and owner-access checks; it is not automatically a reason to grant wider permissions.

AZ-401: Azure Pipelines Workload Identity and Service Connections develops that platform's workload identity path. AZ-401: GitHub Actions OpenID Connect Trust for Azure covers the separate Azure federation boundary. Neither turns an installation token, workflow token or user PAT into interchangeable credentials.

Authoritative Sources

0 views