> For the complete documentation index, see [llms.txt](https://docs.expel.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.expel.io/connect-your-technology/l-p-integrations/microsoft/microsoft-azure-kubernetes-service-setup-for-workbench.md).

# Microsoft Azure Kubernetes Service Setup for Workbench

Expel's Azure Kubernetes Service (AKS) offering consumes audit logs from the Azure platform via Azure Log Analytics  (Azure Monitor). Additionally, via a read-only Azure Role, Expel is able to communicate with AKS clusters. This visibility allows Expel to identify activity of interest in AKS, investigate, and notify organizations when action is recommended.

<figure><img src="/files/o5fr6P6St0qkeUFDGvpd" alt="Flow chart of data coming from AKS to Expel."><figcaption></figcaption></figure>

## Step 1: Create a Storage Account for AKS Logs

The steps below outline creating a storage account for AKS logs. Expel integrates with this storage bucket to consume logs.

1. Log in to the [Azure Portal.](https://portal.azure.com/)
2. Navigate to the **Storage accounts** page.
3. Select **Create storage account**.
4. Assign the storage account to a subscription and resource group, and then name it.

<div align="left"><figure><img src="/files/Fh19qOqBH8hEYuR6yjqf" alt="Image of the Create a Storage Account screen." width="375"><figcaption></figcaption></figure></div>

5. Keep all other settings as default.

{% hint style="info" %}
Optionally, on the **Networking** tab, you can also restrict network access to Expel’s egress IPs, listed in [Configure an IP Allow List](/workbench-setup/configure-an-ip-allow-list.md).
{% endhint %}

6. After you finish, review your settings and create the storage account.
7. Navigate to ​**Lifecycle Management**​, and then select ​**Add a rule**​​.

<div align="left"><figure><img src="/files/wxLQMYo8M010jxtJqaxX" alt="Image showing searching for and selecting lifecycle management." width="494"><figcaption></figcaption></figure></div>

8. On the ​**Details**​​ tab, select the following settings:
   * In the ​Rule scope​ section, select ​**Apply rule to all blobs in your storage account**​​.
   * In the ​Blob type​ section, select ​**Append blobs**​​.
   * In the ​Blob subtype​ section, select ​**Base blobs**​​.
9. Select ​**Next**​​.
10. On the ​**Base blobs**​​ tab, select the following settings:
    * In the ​Base blobs were​ section, select ​**Last modified**​​.
    * In the ​More than (days ago)​ field, enter **​7​​**.

{% hint style="info" %}
Optionally, you can extend this time period.
{% endhint %}

11. Select ​**Add**​​.

## Step 2: Configure Kubernetes Logging

The steps below outline enabling the required audit logging for onboarding AKS with Expel Workbench.

1. Log in to the [Azure Portal](https://portal.azure.com/).
2. Navigate to the **Kubernetes services** page.

<div align="left"><figure><img src="/files/qKv8BWe8cEJKsmC7ql6y" alt="Searching for the Kubernetes services page using the top search field." width="300"><figcaption></figcaption></figure></div>

3. Select your Kubernetes cluster, and then navigate to **Diagnostic settings**.

<div align="left"><figure><img src="/files/0ek801p6gGf3zKFgyvon" alt="Image showing the diagnostic settings for an example cluster." width="432"><figcaption></figcaption></figure></div>

4. Select **Add diagnostic setting** to begin configuring audit logging for the cluster.
5. Complete the Diagnostic setting form:
   * In the Logs section, select ​**Kubernetes Audit**​.
   * In the Destination details section, select **Archive to a storage account**, and then choose the ​Storage account​​ you created in [Step 1](#step-1-create-a-storage-account-for-aks-logs).

{% hint style="info" %}
Additional diagnostic logs can optionally be enabled, but are not used by Expel for security monitoring and can incur additional Azure cost.<br>
{% endhint %}

<div align="left"><figure><img src="/files/vqWrRqUMOqvsVG52REXy" alt="Image of the diagnostic settings screen." width="563"><figcaption></figcaption></figure></div>

6. Select **Save**.

## Step 3: Create Microsoft Entra ID Application Registration

The steps below outline how to grant Expel access to Kubernetes audit log data in Azure Log Analytics for onboarding with Workbench.

1. Log in to the [Azure Portal](https://portal.azure.com/).
2. Navigate to **Microsoft Entra ID**.
3. Navigate to App registrations, and then select **New registration**.
4. Give the application a meaningful name.
5. In the **Supported account types** section, keep the default selection.
6. Select **Register**.
7. Copy the **Application (client) ID** and **Directory (tenant) ID** for later.

<div align="left"><figure><img src="/files/98VO9AAXojuVgUs0we5J" alt="Image showing where to copy the necessary values under the Essentials section." width="333"><figcaption></figcaption></figure></div>

8. Navigate to **API permissions**, and then select **Add a permission**.
9. Select **APIs my organization uses**, and then search for and select **Log Analytics API**.
10. On the **Request API permissions** panel, do the following:&#x20;
    * Select **Application permissions**.
    * Select the **Data.Read** checkbox.
    * Select **Add permissions**.

<div align="left"><figure><img src="/files/5gAQut6DpMwx9Oz2NBro" alt="Image showing the selection of the Data.Read permission, under Data." width="441"><figcaption></figcaption></figure></div>

11. Navigate to **Certificates & secrets**, and then select **New client secret**.
12. On the **Add a client secret** panel, do the following:&#x20;
    * Add a **description** for the secret.
    * Choose the **expiration date**.
    * Select **Add**.
13. Copy the **secret value** after it is created.

## Step 4: Create a Custom Azure Role for Expel

Expel requires a custom Azure IAM role to grant finely grained read-only access to AKS clusters. This access is used in security alert investigations and proactive risk management.&#x20;

{% hint style="info" %}
The custom role requires the use of the Azure AD authentication with Azure RBAC authentication setting. Clusters configured to use Kubernetes RBAC are not currently supported for proactive risk management and have limited investigative support.
{% endhint %}

1. Navigate to **Subscriptions**, and then select the subscription to monitor.
2. Navigate to **Access control (IAM)**, and then select **Add > Add custom role**.

<div align="left"><figure><img src="/files/62HHNnaMBkPkDcaLeC1U" alt="Image of Access Control (IAM)." width="548"><figcaption></figcaption></figure></div>

3. On the **Create a custom role** screen, do the following:
   * Give your role a meaningful **name** and **description**.
   * In the **Baseline permissions** section, select **Start from JSON**, and then upload the [ExpelAKSRole.json](https://github.com/expel-io/terraform-azure-aks/blob/main/static/ExpelAKSRole.json) file.

{% hint style="info" %}
The JSON file preloads Expel’s required permissions for the role.
{% endhint %}

<div align="left"><figure><img src="/files/hNYz5H4wsWZC8GS6hIdf" alt="Image of the custom role screen, with an example name and description." width="563"><figcaption></figcaption></figure></div>

4. On the **Permissions** tab, review the permissions for the custom role. You should see five permissions of type `Action` followed by a list of `DataAction` permissions.
5. On the **Assignable scopes** tab, add any scopes where this role should be assigned. For example, any subscriptions or management groups where AKS clusters exist that Expel monitors.
6. On the **Review + create** tab, select **Create**.

## Step 5: Add Role Assignments

#### Step 5a: Grant Required Permissions for Each Monitored Subscription

For each Azure subscription with AKS clusters to be monitored, add:

* The **Log Analytics Reader**, which allows Expel to query log data ad-hoc during investigations.
* The custom **Expel AKS Role** you created in [Step 4](#step-4-create-a-custom-azure-role-for-expel).

Do the following steps for each subscription:

1. Navigate to **Subscriptions**, and then select the subscription to monitor.
2. Select **Access control (IAM)**, and then select the **Role assignments** tab.
3. Select **Add > Add role assignment**.
4. Assign the role to **User, group or application**, and then select the Expel application registration that you created in [Step 3](#step-3-create-microsoft-entra-id-application-registration).
5. Assign the following roles:&#x20;
   * **Log Analytics Reader**&#x20;
   * **Expel AKS Role**, created in [Step 4](#step-4-create-a-custom-azure-role-for-expel).

#### Step 5b: Grant Access to the Storage Blob

To grant Expel access to the storage blob containing AKS logs, create an additional role assignment.

1. Still in **Subscriptions**, select **Access control (IAM)**, and then select the **Role assignments** tab.
2. Select **Add > Add role assignment**.
3. Select the **Reader role**.

<div align="left"><figure><img src="/files/nPlwArqQJD6c5a4ZquzN" alt="Image showing the use of the search field to find the Reader role." width="563"><figcaption></figcaption></figure></div>

4. Assign the role to the Expel application created in [Step 3](#step-3-create-microsoft-entra-id-application-registration).

<div align="left"><figure><img src="/files/6pwQsGzlRLEm3K10VYB9" alt="Image of the Add Role Assignment screen." width="563"><figcaption></figcaption></figure></div>

5. On the **Review + assign** tab, select **Review + assign**.

## Step 6: Configure the Technology in Workbench

The following steps explain how to finish onboarding AKS in Expel Workbench.

1. [Log in to Workbench](https://workbench.expel.io/).
2. Navigate to **Organization Settings > Security Devices**.
3. Select **Add security device**.
4. Search for and select **Azure Kubernetes Service**.
5. Name the device, provide a description, and then complete the following fields:&#x20;
   * **Application (client) ID** - provide the client ID you copied in Step 3.
   * **Directory (tenant) ID** - provide the tenant ID you copied in Step 3.
   * **Application secret** - provide the secret you copied in Step 3.
   * **Storage account name** - provide the storage account name you copied in Step 1.
6. Select **Save**.

Your device should be created successfully within a few seconds. A few reminders:

* After your connection is healthy, it will take some time for your device to begin polling and receiving data.
* To check on the status, select the downward arrow for your device in the first column and choose **View details**.
* Polling will happen first; data will be received after that. **You must refresh the page to see updates.**
* If your device does not begin polling within 15 minutes, and does not begin receiving data within 30 minutes, [contact our support team for help](/support/how-to-reach-us.md).
* To check if alerts are coming through, navigate to **Dashboards > Alert Analysis**. Scroll to the device you want to check, and select the **Expel Alerts** tab to reveal more alert information. It can take 36 to 72 hours for alerts to appear after setup, as we [tune your device](/workbench-reference/alerts/how-expel-alerts-work.md#device-tuning).


---

# 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.expel.io/connect-your-technology/l-p-integrations/microsoft/microsoft-azure-kubernetes-service-setup-for-workbench.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.
