> ## Documentation Index
> Fetch the complete documentation index at: https://help.draftable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Self Hosted Deployment on Azure

> Deploy Draftable API Self-Hosted v2 (legacy) on Microsoft Azure by running the container on a Linux virtual machine, with Key Vault and a managed identity.

> [!WARNING]
>
> **API Self-Hosted v2 is deprecated.** Existing v2 deployments will continue to run, but v2 will no longer receive feature updates or non-critical fixes. Plan an upgrade to v3: see [Migrating from API Self-Hosted V2 to V3](https://help.draftable.com/hc/en-us/articles/52985002658841-Migrating-from-API-Self-Hosted-V2-to-V3.md).

> [!NOTE]
>
> **Running a Linux virtual machine with Docker Compose remains our best-supported approach on Azure.** For a v3 deployment, follow the [API Self-Hosted v3 Docker Compose Guide](https://help.draftable.com/hc/en-us/articles/51141426113049-Draftable-API-Self-Hosted-v3-Docker-Compose-Guide.md) for the container configuration — the Azure setup steps below still apply, but the Docker Compose file and image names on this page are Version 2 and should not be used for a new deployment.
>
> Azure Kubernetes Service (AKS) also works. Because Draftable has no Azure Blob Storage backend, an AKS deployment requires a shared network file share rather than object storage, which carries a real performance cost for documents containing large numbers of embedded objects. If you are committed to AKS, see the [Azure AKS Deployment Guide](https://help.draftable.com/hc/en-us/articles/API-Self-Hosted-v3-Azure-AKS-Deployment-Guide.md), which sets out the measured trade-offs and the support boundaries before you commit to that platform.
>
> See [`FILE_STORAGE_TYPE`](https://help.draftable.com/hc/en-us/articles/51141426113049-Draftable-API-Self-Hosted-v3-Docker-Compose-Guide#file_storage_type) for the supported storage backends.

## Stage 1: Configuring the Azure environment

Many components need to be ready before configuring the virtual machine and setting up the container. You may already have some of these configured, so skip any steps that are already complete.

### Resource group

Ensure you have a resource group configured so that Azure resources can be allocated to it as they are created.

**Step 1**

Click **Create** to create a resource group, give it a name, and complete the setup.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-12.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=fe76e4d1ff945990dc4ca6ee35d23602)

### Managed identity

You will need a managed identity for the Key Vault process.

**Step 1**

Click **Create** to create the managed identity, give it a name, and complete the setup.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-13.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=b98985799deea98fb300fbd1e9b795c1)

### Key Vault

Create a Key Vault to store **keys**, **secrets**, **access policies**, and **certificates**.

**Step 1**

Click **Create** to create the Key Vault, give it a name, and complete the setup.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-14.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=8dbf3cc9dfd4092d2548ebc2f8627011)

Once the Key Vault is created, you need to configure the following components within it. These are required for the virtual machine gateway provisioning.

#### Keys

**Step 1**

Select **Generate/Import** and give the key a name. No additional setup is required.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-15.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=fe461b8d4763658450a8be5c2b80a0df)

#### Secrets

**Step 1**

Select **Generate/Import** and give the secret a name. No additional setup is required.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-16.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=ef09cfd5f9727cfce208b71c8485dcbf)

#### Access policies

**Step 1**

Select **Create** to begin creating an access policy.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-17.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=6e20274277b679e3b74f15f67911ec10)

**Step 2**

Assign permissions to the policy. The **Key**, **Secret**, and **Certificate** management permissions are all required. You can select all permissions depending on your use case.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-18.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=060c5f838f713c8f0737ab07f4dc1a24)

**Step 3**

Assign the managed identity you created earlier as the principal. Search for the identity name and select it.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-19.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=94b98cf182f9ae9b42c8b11fd6632492)

**Step 4**

Skip the optional Application step and proceed to create the access policy.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-20.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=b15ded00303f591349a9543b3da22cbe)

**Step 5**

Review the information, and if correct, select **Create**.

#### Certificates

**Step 1**

Select **Generate/Import** to begin adding your certificate.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-21.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=c192ad67bc7675861ee37e86c4969037)

**Step 2**

You have two methods for certificate setup:

**Generate a certificate:** Fill in the required fields, noting the **Subject** field which is important for configuring a CN.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-22.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=7885140fc316b995573fcc22604a061f)

**Import a certificate:** Select the **Import** method, upload the certificate file with the password. The certificate file must be in **PKCS** format.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-23.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=53f8e8c534df4e1fb6c47cae21727d64)

Once the certificate has been added, you can move on to setting up the virtual machine.

## Stage 2: Setting up the virtual machine

**Step 1**

Select **Create** in the Virtual Machine section of Azure to begin.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-24.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=d5c1cf62fdeba1ae185926b2b9b5fad9)

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-25.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=f118a3cda30199d41ba2ea0b0c1a3f53)

**Step 2**

In the **Basics** tab, configure the following:

* **Resource group** — Select your existing resource group or the one created earlier
* **Image** — We recommend Ubuntu
* **Name** — Provide a name for the virtual machine
* **Region** — Set the region where the machine will be hosted

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-26.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=490ce86ec1a263a397fe99c0b57d4585)

**Step 3**

For the **Size**, ensure you select at least **Standard\_D2s\_V3**. Choosing a smaller size will cause the instance to fail due to lack of resources. The **Username** and **Key pair** name should auto-fill, but provide names for these if needed.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-27.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=8fed87361af63a4af9cd08a8b9cfc7a6)

**Step 4**

Configure your **ports**. This depends on your use case, but a typical setup includes:

* **Port 80** (HTTP)
* **Port 443** (HTTPS)
* **Port 22** (SSH)

Then move on to the **Disks** section.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-28.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=d6b36c00cb9ec4f73c0f49056f457a99)

**Step 5**

Configure the **OS disk size** and **disk type**:

* **Disk size** — At least **30 GiB** (scale to your use case)
* **Disk type** — We recommend **Standard SSD**

Then move on to **Networking**.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-29.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=c980f4187325b5dfd2ed112b44b734a0)

**Step 6**

We recommend creating new resources for the **Virtual network**, **Subnet**, and **Public IP**, unless you wish to use existing resources.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-30.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=9dc5c123ac3690ae061bda58d6fb06ff)

**Step 7**

For load balancing, select **Application Gateway** — this will act as a load balancer and allow you to use the custom certificates configured earlier. Select **Application Gateway**, then choose **Create an application gateway**.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-31.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=d6747a1479b87f7f905ecbda2423c1c0)

In the gateway configuration panel:

* Provide a **name** for the gateway
* Set the **port** to **443**
* Set the **Protocol** to **HTTPS**
* For **Choose a certificate**, select **Choose a certificate from Key Vault**
* Select the relevant **Managed identity**, **Key vault**, and **Certificate**
* Click **Create**

Then move on to the **Management** section.

**Step 8**

There is no required configuration in the **Management**, **Advanced**, or **Tags** tabs (default settings are shown below). You can configure settings here as needed.

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-32.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=a500c6bd21820080678ca9ab1e0304c1)

![](https://mintcdn.com/draftable/xiYLgQoBwoYUCU65/images/draftable-api-self-hosted/image-33.png?fit=max\&auto=format\&n=xiYLgQoBwoYUCU65\&q=85\&s=75fbd678cbff3becf60a5d76383279b3)

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-34.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=1c70e446fb9d68f05e4347b6b04d3e18)

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-35.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=76df97820ce37820db7e5e0027cb6918)

**Step 9**

In the **Review + Create** tab, verify all the settings and confirm the validation check has passed. If everything is correct, select **Create** to begin deployment.

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-36.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=b3ac42b8c71fb8a8cfc9228fd97b90ed)

Deployment may take some time. Once complete, click **Go to resource** to proceed with container configuration.

## Stage 3: Configuring the virtual machine and launching the container

### Connecting to the virtual machine

**Step 1**

Once the virtual machine is running, click **Connect** and select **SSH using Azure CLI**.

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-37.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=5c2fbc4348ed627a1ad4f38ed4861d91)

**Step 2**

Wait for the validation checks to complete, then click **Connect**.

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-38.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=57ffba4178241073f39c91815e7c7713)

**Step 3**

A Cloud Shell CLI will launch in your browser. Type **Yes** to accept the fingerprint and connect.

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-39.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=7b4578420d87ca5ff161d66ccfcc1880)

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-40.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=7ae758ac36b2a481a8cd2edc6e77d73b)

### Installing Docker

**Step 1**

Run the following commands to set up the Docker repository:

```bash theme={null}
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-41.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=ea821cca669777311556bb7cad8813c0)

**Step 2**

Add the Docker repository to your sources:

```bash theme={null}
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-42.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=ffcaffc8dd3d1fbdc718330fc8b39f5d)

**Step 3**

Install Docker:

```bash theme={null}
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-43.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=962022b9c9b9d478a07b63857db6cad5)

**Step 4**

Verify the installation by running the `hello-world` image:

```bash theme={null}
sudo docker run hello-world
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-44.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=f7e0762714ab1a7dd6a2b677781d7966)

If you see a success message, Docker is installed correctly.

### Pulling and configuring the Draftable container

**Step 1**

Pull the latest Draftable API Self Hosted image:

```bash theme={null}
sudo docker pull draftable/apish:latest
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-45.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=1229709b26c13f172238fb53cebf88b0)

**Step 2**

Navigate to the root directory and create a folder for your Docker Compose file:

```bash theme={null}
cd /
ls
sudo mkdir composefiles
ls
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-46.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=0a9d7250ac5cce25478d99c6e5db985d)

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-47.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=e854897d36863f8adae764ab29f83895)

**Step 3**

Navigate into the folder and create the `docker-compose.yml` file:

```bash theme={null}
cd composefiles
sudo touch docker-compose.yml
sudo nano docker-compose.yml
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-48.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=23619e1a843212edd7de607ab3b27ef8)

**Step 4**

In the `nano` editor, paste the following basic configuration. For additional parameters, refer to our [API Self Hosted documentation](https://help.draftable.com/hc/en-us/articles/7132278452249-New-to-Draftable-API-Self-hosted-Start-here.md).

```yaml theme={null}
version: '3.5'
services:
  apish:
    environment:
      DRAFTABLE_APISH_NGINX: |-
    image: draftable/apish
    ports:
       - 80:80/tcp
       - 443:443/tcp
    volumes:
      - draftable-apish:/srv/draftable
      - /sys/fs/cgroup:/sys/fs/cgroup
volumes:
  draftable-apish:
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-49.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=3a51b52baa8314258e5db21583609431)

Save the file with `Ctrl+O` and exit with `Ctrl+X`.

### Starting the container

**Step 1**

Start the Docker service:

```bash theme={null}
sudo systemctl start docker
```

**Step 2**

Install the Docker Compose plugin:

```bash theme={null}
sudo apt-get update
sudo apt-get install docker-compose-plugin
```

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-50.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=5cbdb6f040df74415ab5a2b36daddbff)

**Step 3**

Launch the container with Docker Compose:

```bash theme={null}
sudo docker compose up
```

The container will begin its boot sequence. Give it time to configure, and upon successful completion you should see a message saying `Container startup complete.`

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-51.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=cafe7711b24495ac2a85db8a29dd43f8)

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-52.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=fafc2bd951816228e9eae3a37d590180)

**Step 4**

Navigate back to the virtual machine in Azure to retrieve the **public IP address**. Copy it and enter it into your browser to connect to the instance.

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-53.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=708273f1656693998cad7e281eeba576)

You should see a screen similar to below, confirming the container is running correctly.

![](https://mintcdn.com/draftable/YGM9Qz2FWPff3K0D/images/draftable-api-self-hosted/image-54.png?fit=max\&auto=format\&n=YGM9Qz2FWPff3K0D\&q=85\&s=0a41ce81a79cbdd364e77fe819c316ba)

## Next steps

You will now need to set up the administrator account. See [Draftable Self-hosted instance first time configuration](https://help.draftable.com/hc/en-us/articles/8424839618457-Draftable-Self-hosted-instance-first-time-configuration.md) for details.

If you have any issues or questions, please contact us at [support@draftable.com](mailto:support@draftable.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.