> For the complete documentation index, see [llms.txt](https://docs.balkan.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.balkan.id/getting-started/setting-up-your-tenant/application-integrations/direct-application-integration/on-premise-active-directory-agent/install-the-agent.md).

# Install the agent

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

Before installing the AD Agent, ensure you have:

* **Administrator privileges** on the target machine
* **Network access** to your Active Directory domain controller(s) and LDAP(s) enabled on the Domain Controller(s)
* **Internet connectivity** to `https://d3g543zyzzpcxb.cloudfront.net/` for automatic agent updates (verify with `Test-NetConnection -ComputerName d3g543zyzzpcxb.cloudfront.net -Port 443`)
* Create a user account with appropriate AD permissions: \
  Follow the below steps to configure permissions in AD:

  * Go to individual domain controller (DC) machine >Active Directory Users and Computers App
  * Go to properties of the DC (corp.example.com) > Security > Click Add.
  * Add the below permission:
    * "Read" Permission (Required for Application Discovery)

  Kindly refer to [Configuration](/getting-started/setting-up-your-tenant/application-integrations/direct-application-integration/on-premise-active-directory-agent/configuration.md#h_01j5r9r7pmaq7g0ck77yz4hxhm) for the appropriate scopes
* **(For Heartbeat Mode)** BalkanID credentials:
  * Tenant ID
  * Tenant Key
  * Tenant Secret
  * Integration ID

***

### Installation <a href="#installation" id="installation"></a>

#### Step 1: Download the Installer Script <a href="#step-1-download-the-installer-script" id="step-1-download-the-installer-script"></a>

Download the `install.ps1` script from the official BalkanID distribution URL:

* Direct link: [`install.ps1`](https://d3g543zyzzpcxb.cloudfront.net/files/balkanid/ad-agent/latest/install.ps1)

You can either:

* **Download via browser** and save it (e.g., to `C:\temp\` or `Downloads`), or
* **Download via PowerShell** (run in an elevated PowerShell window):

  ```powershell
  Invoke-WebRequest `
    -Uri "https://d3g543zyzzpcxb.cloudfront.net/files/balkanid/ad-agent/latest/install.ps1" `
    -OutFile "C:\temp\install.ps1"
  ```

Adjust the `-OutFile` path as needed.

#### Step 2: Run the Installer <a href="#step-2-run-the-installer" id="step-2-run-the-installer"></a>

1. **Open PowerShell as Administrator**:
   * Right-click on PowerShell
   * Select "Run as Administrator"
2. **Run the installer**:

   ```powershell
   .\install.ps1
   ```

   The installer will:

   * Download the latest AD Agent executable from the CDN
   * Install it to `C:\Program Files\BalkanID\ad-agent\`
   * Create configuration directory at `C:\ProgramData\BalkanID\ad-agent\`
   * Create logs directory at `C:\ProgramData\BalkanID\ad-agent\logs\`
   * Install the Windows service `BalkanIDADAgent`

#### Step 3: Verify Installation <a href="#step-3-verify-installation" id="step-3-verify-installation"></a>

After installation completes, verify the service is installed:

```powershell
Get-Service -Name "BalkanIDADAgent"
```

You should see the service listed. The service may be stopped initially until configuration is complete.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.balkan.id/getting-started/setting-up-your-tenant/application-integrations/direct-application-integration/on-premise-active-directory-agent/install-the-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
