# Quickstart

## Introduction

Abbey is an access governance platform that helps you automate access requests and approvals, making it easier for people to get access to resources like AWS S3 or Google Groups. This helps you get access to the resources you need, when you need it.

This tutorial teaches you how to get Abbey up and running, define time-bound access policies, and go through the request/approval flow for getting access to a resource.

## Before you start

1. Create an [Abbey Account](https://accounts.abbey.io/sign-up) - keep this page open, you'll need it for the rest of the tutorial!
2. Log into your [GitHub](https://github.com/) account

{% hint style="info" %}
Abbey works with both GitHub and GitHub Enterprise (Cloud).
{% endhint %}

## Check the Demo Site

Go to [Abbey Demo Site](https://app.abbey.io/demo), login, and you'll see the following screen below

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FzHUkQQQ7EVvJ3bQbku8o%2FExport-1701914929716.gif?alt=media&#x26;token=f807b878-c204-42d8-9718-2f0556a1a48b" alt=""><figcaption><p>No access to demo site</p></figcaption></figure>

{% hint style="info" %}
:checkered\_flag: That's expected! You don't have access yet. This Quickstart will allow you to configure a Grant Kit for the demo site so you can request and approve access.&#x20;
{% endhint %}

## Step 1: Clone this Repo in Git

{% hint style="info" %}
For this step, you'll be working in

* Github
  {% endhint %}

First, we'll create a new repo in your GitHub account based off our quickstart template repo.

1. Go to our [Quickstart on Gitub](https://github.com/abbeylabs/abbey-starter-kit-quickstart)
2. Click on **Use this template**

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2F474aKnCfW1tkSomyaUj6%2FScreenshot%202023-12-14%20at%202.09.57%E2%80%AFPM.png?alt=media&#x26;token=7789453c-dec5-4949-a591-cde7ba0677a3" alt=""><figcaption></figcaption></figure>
3. Click on **Create a new repository** to create the repository
4. Fill out the **Repository name**
5. Click **Create repository**

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FuOnJmJWl16PRFjIVlsg8%2Fclone_repo_template.gif?alt=media&#x26;token=77b30e6f-4413-473d-9272-af3b8379313c" alt=""><figcaption><p>Create new repository from abbey quickstart template repo</p></figcaption></figure>

{% hint style="info" %}
:checkered\_flag: At this point, you should have a repository in your own GitHub account that is based off the Abbey Quickstart Repository
{% endhint %}

## Step 2: Connect Abbey to your Repo

{% hint style="info" %}
For this step, you'll be working in

* Abbey App
* GitHub
  {% endhint %}

To use Abbey for access requests, you'll need to connect Abbey to your GitHub.

### Create a Connection

1. Go to the Abbey App ([app.abbey.io](https://app.abbey.io))
2. Go to the **Settings > Version Control** page and click :heavy\_plus\_sign:**Create a Connection**

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FEJE6SZTkj2V3JXDNoXJL%2Fimage.png?alt=media&#x26;token=96a600d5-4aa7-4548-9896-59f27677fe3f" alt=""><figcaption></figcaption></figure>
3. Choose a name for your connection, then click **Create**. You'll be redirected to GitHub to install Abbey on your GitHub account.

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FGIt18i7MpfbMtCt4QVqf%2Fimage.png?alt=media&#x26;token=b925a48b-cd96-496c-9bc2-d1ad767155a4" alt=""><figcaption></figcaption></figure>
4. In the Github App Permissions screen, choose either **All Repositories** or **Only select repositories** with the repository you created earlier in Step 1 selected

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2Fl839PXyMvQcYVxHaPIKc%2Fimage.png?alt=media&#x26;token=c3636c0f-c6f7-46f4-bce8-3a5ea0da2f01" alt=""><figcaption></figcaption></figure>

&#x20;5\. Once you click **Install & Authorize**, you'll be redirected back to the Abbey App, and your connection will be created :tada:

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2Flr9CfQJVQ0nWlJjvieTi%2Fcreate%20a%20github%20connection.gif?alt=media&#x26;token=25042c26-128f-494c-8348-c85e53fccdac" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
:checkered\_flag: Congrats! You've now authorized Abbey to talk with the newly created GitHub repo in your personal account

At this point you should&#x20;

1. Have a connection to GitHub under the Abbey Settings -> Version Control tab
2. Have created a repo into your own GitHub account based off the Abbey Labs Quickstart Repo
3. Have cloned the newly created repo into your own terminal to work with
   {% endhint %}

## Step 3: Configure Permissions for Abbey

{% hint style="info" %}
For this step, you'll be working in

* Abbey App
* Github
  {% endhint %}

### Create an Abbey Token

1. Go to Abbey API Tokens via **Settings -> API Tokens** in the Abbey app
2. Click on the **+ New API Token**
3. Enter a name for your new API token or leave as is
4. Configure the **Expires At** field or leave it blank to have the token never expire
5. Click **Create** to make the new key
6. Copy the key - you'll need this for the next step!

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FxCMmKhU0u0XZHwTsddTL%2Fcreate%20an%20api%20token.gif?alt=media&#x26;token=638c7164-5986-48d3-adc8-870dedf90f00" alt=""><figcaption><p>Create an Abbey API Token</p></figcaption></figure>

### Add your Abbey token to Github

1. Navigate to the repo you created in your own GitHub account
2. Go to the **Settings** tab
3. Select **Secrets and Variables -> Actions** on the left side
4. Create a new **Repository Secret**&#x20;

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2Fy3aRKwaZvQMTzIxfSE8t%2FNew%20repo%20secret%20button.png?alt=media&#x26;token=551c31a9-6493-4e61-ade3-1dc56a6208e6" alt=""><figcaption><p>Create a new repository secret</p></figcaption></figure>
5. For the **Name,** enter in `ABBEY_TOKEN`
6. For the **Secret,** enter in the value of the Abbey API token you created in the last step.
   1. :warning: Make sure you don't have any newlines or spaces when copy/pasting this
7. Click **Add Secret** to finish adding the repository secret

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2F13X8cFTCOpxK1Skgk3d3%2Fadding%20repo%20secret.gif?alt=media&#x26;token=33999e94-9b89-4596-9ab1-6c77669f2a65" alt=""><figcaption><p>Save ABBEY_TOKEN as a Repository Secret</p></figcaption></figure>

<details>

<summary>What should it look like?</summary>

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FMAwRPBHZlY6PLUItf5nO%2Fimage.png?alt=media\&token=0c068627-614d-4f2d-94ac-200b2eae1852)

</details>

### Update Repo Permissions

Abbey needs a few permissions to operate in your GitHub repo.

1. Go to the **Settings** tab of the same repo you added the API token
2. Select **Actions -> General** on the left side
3. Scroll to the **Workflow Permissions** section
4. Select the **Read and write permissions** button
5. Click on **Save** in the **Workflow Permissions** section

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2Fg7EmIlVMhZ7iwcNUH6bU%2Fsave%20workflow%20permissions.png?alt=media&#x26;token=14eb1eef-df2f-4eed-a2ef-23c1c7f57b8a" alt=""><figcaption><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> There are multiple Save buttons - make sure to click the Save button in the Workflow permissions section, not the others.</p></figcaption></figure>

{% hint style="info" %}
:checkered\_flag: Great! Now you've allowed Abbey to interact with the new repository you just created to manage access requests.
{% endhint %}

## Step 4: Configure your Grant Kit

{% hint style="info" %}
For this step, you'll be working in

* GitHub Web IDE (github.dev)
  {% endhint %}

We'll now edit the files within the cloned Github repo.&#x20;

We recommend using Github's native code editor, but feel free to edit the files with whatever tools you prefer.&#x20;

<details>

<summary>[Recommended] Using the github.dev web-based editor</summary>

Go to your repository on Github that you just created

1. Open `main.tf` in your repository

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2F34hVu8nE7XVS2kDb6o18%2FScreenshot%202023-12-15%20at%2010.36.33%E2%80%AFAM.png?alt=media&#x26;token=a424a2f7-0f3f-4b8d-86dd-673eebccafa3" alt=""><figcaption></figcaption></figure>
2. Press `.` or click on the arrow next to the pencil icon to select **Open with... -> github.dev**

   &#x20;![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2F0iyXYhpnYiDF9ULBQKG2%2FScreenshot%202023-12-15%20at%2010.38.41%E2%80%AFAM.png?alt=media\&token=fd73f5f2-b394-4d41-b223-deb130c14326)
3. This will open up the `github.dev` editor - you can make changes to your files here, and directly push them to your repository.

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FZPKjJ1TGRHqn1AL5NadM%2FScreenshot%202023-12-15%20at%2010.41.50%E2%80%AFAM.png?alt=media&#x26;token=116ccaaf-a0e5-47d7-bb48-e5e8b4d0df30" alt=""><figcaption></figcaption></figure>

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FBnb46oT6UgOxpzXjFVxi%2Fopen%20up%20github%20editor.gif?alt=media&#x26;token=84f28e7c-61b6-48c2-98ce-de907e2c3a29" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Using your own Terminal</summary>

1. Click on the **<> Code** dropdown
2. Copy the text under **HTTPS** starting with *https\://*
3. Clone the repository in your development environment by running `git clone` followed by the `https://` URL copied from the previous step in your terminal of choice.

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FypWgx90s7iZEISz3m0sX%2Fget_repo_url.gif?alt=media\&token=d7d9172a-5678-4af8-b418-52616d4ad86e)

Once you copy the URL of the new repo from GitHub, you should

1. Open your terminal (Terminal, iTerm, etc)
2. Type `git clone` followed by your repo
   1. Example: `git clone https://github.com/alice/abbey-starter-kit-quickstart.git`&#x20;
3. `cd` to the directory via `cd abbey-starter-kit-quickstart`

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FbMwvp7Qf2s8xXas2eUx1%2Fclone%20repo%20in%20terminal.gif?alt=media\&token=e0ddb98e-360f-4edb-8cc2-6df3ce98a1d9)

More instructions can be found in the [GitHub docs](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) if you run into issues while cloning.

</details>

**Grant Kits** define who can approve an access request, how long that access should last, and what resource the request is granting access to.&#x20;

The repository you cloned in the previous step contains the grant kit that we'll be modifying below to grant access to the demo site.

### Configuring Output

Grant Kits rely on your GitHub account and repository name to output access changes, which we'll set through Terraform local variables. Update the `locals` block in `main.tf` with your `account_name` and `repo_name`

{% code title="main.tf" %}

```hcl
 locals {
  account_name = "" #CHANGEME
  repo_name = "" #CHANGEME
  ...
}
```

{% endcode %}

### Configuring Reviewers

Workflow defines who should approve an access request.&#x20;

Let's update the `reviewers` block by adding yourself as the reviewer by switching `replace-me@example.com` with the email address you use to sign into Abbey.&#x20;

{% code title="main.tf" %}

```diff
 resource "abbey_grant_kit" "abbey_demo" {
   name = "Abbey_Demo_Site"
   ...
   workflow = {
     steps = [
       {
         reviewers = {
-          one_of = ["replace-me@example.com"] # CHANGEME
+          one_of = ["alice@example.com"]
```

{% endcode %}

### Configuring Policies

**Policies** are used to define rules around access requests, such as time-based access or automatic approval if a user is on-call in PagerDuty.

Update the policy in `policies/common/common.rego` so that access to the Demo Site automatically expires after 1 hour, not 6 hours.

<pre class="language-diff" data-title="common.rego"><code class="lang-diff"> allow[msg] {
-     functions.expire_after("6h")
+     functions.expire_after("1h")    
<strong>-     msg := "granting access for 6 hours"
</strong>+     msg := "granting access for 1 hour"
  }
</code></pre>

{% hint style="info" %}
:checkered\_flag: Great job, you're almost there! Now your grant kit has been fully configured with updated reviewers, policies, and output. Double check that all the lines with `#CHANGEME` have been updated before moving on to the next step.

We'll commit and push these changes in the next step.
{% endhint %}

## Step 5: Deploy your Grant Kit

{% hint style="info" %}
For this step, you'll be working in

* GitHub Web IDE (github.dev)
  {% endhint %}

Now we're going to take the Grant Kit you modified in the previous step and deploy it to GitHub.&#x20;

<details>

<summary>[Recommended] Deploying through the github.dev editor</summary>

Once you make a change, there will be an icon on the left-side that will pop up. If this doesn't make sure your edits were in the github.dev editor and they were saved.

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FcoA7f3lLbPPXKfFYfPle%2FScreenshot%202023-12-15%20at%2010.44.32%E2%80%AFAM.png?alt=media\&token=01229a3a-c806-4696-9172-46edbfb4f839)

To submit those changes and deploy your grant kit:

1. Click on the icon circled above
2. Type a commit reason in the box with the label message
3. Click on **Commit & Push**

   <figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FRQNz5Gruvv6L10bQwbdk%2FScreenshot%202023-12-15%20at%2010.46.20%E2%80%AFAM.png?alt=media&#x26;token=823f884d-f93d-498f-b45d-156ee8841e93" alt=""><figcaption></figcaption></figure>

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2F5ElZGgT6K9qbgGIdomoa%2Fcommit%20and%20push%20with%20github%20editor.gif?alt=media\&token=45b99abc-3491-42fb-8d5d-dcabd6c63dad)

</details>

<details>

<summary>Deploying using your terminal</summary>

To deploy, push to your default branch from your terminal within your repository:

```sh
git push origin main
```

</details>

Abbey works with any CI system to deploy your grant kit through Terraform, and for this quickstart we use GitHub Actions - you can look at the *Actions* tab of your GitHub repo to see Terraform runs.&#x20;

{% hint style="info" %}
:tada: Congrats! At this point, you should see your deployed grant kit under Abbey Resources. In the next step, we'll show you how to use the grant kit to get access to the demo site.&#x20;

If it's not showing up, it likely has a configuration issue causing the deployment to fail - open up the Troubleshooting section below for common steps to resolve.&#x20;
{% endhint %}

<details>

<summary>Troubleshooting</summary>

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2Fcc43wUHb99p0w8bQS9jg%2FActions%20tab%20in%20github.png?alt=media\&token=052991d9-3b28-4ceb-b5f7-603a3a76a763)

1. Open the Actions tab in your GitHub repository
2. Find the corresponding action run to the commit where you added the grant kit and see if it ran successfully. If it failed, open the run to see the failure exception.
   1. A failed run will have a :x: next to it instead of :white\_check\_mark:

![](https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FN2yhSh7F0svdROmcEWIH%2Ftroubleshoot%20github%20actions%20run.gif?alt=media\&token=9c71c560-71bd-40a4-a807-d0d4a552fd38)

A common deployment failure for grant kits is a misconfigured `location` field in the `output` block or `bundle` field in the `policies` block

* Double check it starts with `github://`
* Double check repository and username or org name is correct
* Double check for any extra `:` or `/`'s

If these don't solve the issue or the error message is unclear, you can always reach us at <hello@abbey.io> or in our [Slack](https://join.slack.com/t/abbey-io/shared_invite/zt-28t1taumd-mI7Kg4pN0X9RYkcTB7NkIw) - we'd love to help!

</details>

## Step 6: Make an Access Request

{% hint style="info" %}
For this step, you'll be working in

* Abbey App
  {% endhint %}

We've now completed all the steps for an admin to automate access grants to the Abbey demo site.&#x20;

Now let's go through the experience as an end user making a request for access.&#x20;

1. Go to the Resources tab of the Abbey App
2. Find the grant kit with the name **Abbey\_Demo\_Site**
3. Click on the **Request**
4. Click on the **Expire after** dropdown to customize the time the access should last, otherwise skip to step 5
5. Enter in a reason, then hit **Confirm** to submit the request

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FXuglNhfvKU2jQqPpiLKN%2Frequest%20access.gif?alt=media&#x26;token=6bf891a8-6ac0-49c5-9b27-35dd5452df0d" alt=""><figcaption><p>Make an Access Request</p></figcaption></figure>

{% hint style="info" %}
:tada: You just submitted your first access request using Abbey! In the next step, we'll approve the request and then you'll be able to access the demo site.
{% endhint %}

## Step 7: Approve an Access Request

{% hint style="info" %}
For this step, you'll be working in

* Abbey App
  {% endhint %}

For this grant kit, we've set ourselves as the reviewer to make things simple. In a real-world use-case you'd typically set a manager or another team as the approvers.

To approve the request:

1. Go to the Approvals tab of the Abbey App
2. Find the request you just made (there should only be one)
3. Click **Approve** to the right of the request
4. Enter in a reason, then hit **Approve** to submit

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FydfkmPt3fdJIpwBKoyRX%2Fapprove%20request.gif?alt=media&#x26;token=7dea8e66-4846-47da-ab0c-7c526987ab3e" alt=""><figcaption><p>Approve an Access Request</p></figcaption></figure>

## Step 8: Request Access to the Demo Site

Your access request has been approved, so go ahead and check out the [Abbey Demo Site](https://app.abbey.io/demo). You should see the following screen!

<figure><img src="https://1502779850-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FudoTqG501gLo2MLzBG55%2Fuploads%2FAVQTnDwKpt5O9C55fYjJ%2Fhas_access_demo_site.gif?alt=media&#x26;token=bf3c9349-9550-47bd-bf90-e91d540fc26d" alt=""><figcaption></figcaption></figure>

## Wrap up

Congrats :tada: In this guide, you were able to&#x20;

* Create a Grant Kit defining access to the Abbey Demo Site
* Add yourself as a reviewer for access requests
* Configure a time-based policy for limiting access to 1 hour max
* Make, and approve, an access request for yourself to gain access to the Demo Site

There are a lot of moving pieces involved, so if you'd like to learn more you can

* :books: Check out our [how-abbey-works](https://docs.abbey.io/how-abbey-works "mention") docs for a high level breakdown
* :construction\_worker: Get hands on with our [tutorials](https://docs.abbey.io/getting-started/tutorials "mention") that integrate other services like AWS, GCP, Azure and more&#x20;
