# Access requests

Discover a protected resource from a beam, request temporary access, and use it after a human review.

When an agent needs a resource outside its standing permissions, have it request access to that resource rather than give it a broader role. This walkthrough uses a protected HTTP app and a read-only check. The agent requests access from inside the beam; a human reviews it from outside.

**Install the client tools and sign in**

Beams is a [Teleport](https://goteleport.com) project and uses [official Teleport client tools](https://goteleport.com/download/client-tools/).

The client tools include `tsh` to sign in and run commands, and `tctl` to administer your cluster if you have permission.



Cluster: `example.beams.run`. Edit this example to use your cluster name.

Install version **18.11.10** of the client:

**macOS**

Download and open the macOS installer, then follow its instructions.

```sh
curl -O https://cdn.teleport.dev/teleport-tools-18.11.10.pkg
open teleport-tools-18.11.10.pkg
```

**Linux**

For Linux x86-64, download and install the client tools:

```sh
curl -O https://cdn.teleport.dev/teleport-v18.11.10-linux-amd64-bin.tar.gz
tar -xzf teleport-v18.11.10-linux-amd64-bin.tar.gz
sudo ./teleport/install
```

**Windows**

For Windows x86-64, run these commands in PowerShell. Add the extraction directory (`$env:LOCALAPPDATA\Teleport`) to your user PATH to use `tsh` in future terminals; the last command adds it to this terminal's PATH.

```powershell
Invoke-WebRequest -Uri https://cdn.teleport.dev/teleport-v18.11.10-windows-amd64-bin.zip -OutFile teleport.zip
Expand-Archive -Path teleport.zip -DestinationPath "$env:LOCALAPPDATA\Teleport" -Force
$env:Path += ";$env:LOCALAPPDATA\Teleport"
```

Follow the official client [tools install guide](https://goteleport.com/download/client-tools/) for other versions and architectures.

Check that you’re running v18.11.10 of the client with `tsh version`.

```sh
tsh version
```

**Passwordless**

I sign in without a password (e.g. a passkey).

```sh
tsh login --proxy='example.beams.run' --auth=passwordless
```

**Password \& MFA**

I have a password & MFA set up for my account:

Replace `you@example.com` with your Teleport username.

```sh
tsh login --proxy='example.beams.run' --user=you@example.com
```

**SSO**

I sign in with SSO (e.g. Okta, GitHub, SAML).

```sh
tsh login --proxy='example.beams.run'
```

You need a cluster with agentic access requests enabled, permission to create a beam, and a test HTTP app that the reviewer can access but the beam cannot. Start with `beam-user` if it is available, or substitute a minimal delegatable role. If the beam creator cannot review the request, arrange for a reviewer authorized by your cluster's [access request policy](https://goteleport.com/docs/identity-governance/access-requests/access-request-configuration/).



## 1. Start a beam and find the resource

From your workstation, create a beam to use as an ephemeral runtime for this test. Use the `id` from the create response in place of `my-beam`.

**Local terminal**

```sh
tsh beams add --roles=beam-user --no-share-connected-accounts --no-console --format=json
tsh beams ssh my-beam
```

Replace `staging-status` with your test app's name. Check that the app is not in the beam's standing app list, then look for it in the requestable inventory:

**Inside the beam**

```sh
tsh apps ls
tsh request search --kind=app --search=staging-status --format=json
```

Copy the app's `ResourceID` exactly. A result in this search means the beam can discover the app, not that it can use it. If the app is already available, choose another test app rather than requesting access you already have. If the search returns nothing, check the resource kind and name. Ask your admin about request policy if the resource still doesn't appear. For databases, use `--kind=db`; for SSH nodes, use `--kind=node`.

## 2. Submit a resource request

Replace the example resource ID with the one you copied. Give the reviewer enough context to decide: why you need this resource, what you plan to do, and how long you need it. Ask for the shortest practical duration.

**Inside the beam**

```sh
tsh request create \
  --resource=/example.beams.run/app/staging-status \
  --reason='Verify the staging rollout by reading the status page once' \
  --max-duration=10m \
  --nowait --format=json
```

`--nowait` returns without waiting for a decision. Copy the request `id`, and give the reviewer the link `https://example.beams.run/web/requests/REQUEST_ID` with your cluster's web address and the actual request ID substituted. `PENDING` is not permission to proceed.

## 3. Review as a human

Open the request link in the Teleport Web UI as the beam creator or another authorized reviewer. Check the requesting beam, resource, reason, and expiry before approving or denying it. If the creator cannot see or review it, ask an authorized reviewer rather than trying to approve it from the requesting beam. Who can review the request depends on the creator's access and the cluster's review policy. A review may not be the final decision if the policy requires more than one approval.

An authorized reviewer already signed in to the same cluster can also review it with `tsh`. Replace `REQUEST_ID` with the actual ID. Run only one of these review commands:

**Reviewer's terminal**

```sh
tsh request show REQUEST_ID
tsh request review --approve --reason='Approved for the staging rollout check' REQUEST_ID
```

**Reviewer's terminal**

```sh
tsh request review --deny --reason='This app is not needed for the task' REQUEST_ID
```

## 4. Use the approved access and clean up

Back in the beam, check the decision. If it was denied or expired, stop. If it is still pending, `tsh login --request-id` waits for a decision; you can interrupt the wait without canceling the request. After approval, use the app's actual public address from Teleport in place of the example below. Do not follow a redirect to a Teleport sign-in page as though it were a successful app response.

**Inside the beam**

```sh
tsh request show REQUEST_ID &&
  tsh login --request-id=REQUEST_ID &&
  http_status=$(curl --silent --show-error --output /dev/null \
    --write-out '%{http_code}' https://staging-status.example.beams.run/) &&
  if [ "$http_status" = 200 ]; then
    printf 'Status page returned HTTP 200\n'
  else
    printf 'Expected HTTP 200, got HTTP %s\n' "$http_status" >&2
    false
  fi
```

This check succeeds only on HTTP `200`, the expected response for this status page. It does not follow redirects: a `302` to sign-in fails the check, as does a connection error. For supported apps and databases, use VNet to connect directly from the beam. VNet can select an approved request for the target resource. In contrast, assuming a resource request in `tsh` limits that CLI profile to the resources in the request; it does not combine them with standing access or other resource requests. If another `tsh` command unexpectedly loses access, switch requests with `tsh login --request-id=OTHER_REQUEST_ID`, or return to standing access:

**Inside the beam**

```sh
tsh request drop REQUEST_ID
```

Dropping a request from the CLI is not revocation. Approved access can remain available through VNet until the request expires or is revoked. When done, save any needed work and remove the test beam from your workstation:

**Local terminal**

```sh
tsh beams rm my-beam
```
