> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/a/azure-kubernetes-service.md).

# Azure Kubernetes Service

Azure Kubernetes Service (AKS) is the managed Kubernetes service of Azure. OctoXLabs lists the nodes (machines) of every agent pool of every cluster in a subscription.

## Use cases

* Find devices that Azure Kubernetes Service reports but your EDR does not cover.

```
Adapters = azure-aks AND NOT Adapters = falcon-crowdstrike
```

* Review devices that Azure Kubernetes Service has not seen recently.

```
Adapters = azure-aks AND NOT LastSeen last now-30d/d
```

* Check what one Azure Kubernetes Service connection collected.

```
Connections = YOUR_CONNECTION_NAME
```

## Before you begin

### Network

| Source              | Destination               | Port | Protocol                                                                                 |
| ------------------- | ------------------------- | ---- | ---------------------------------------------------------------------------------------- |
| OctoXLabs connector | login.microsoftonline.com | 443  | HTTPS, or HTTP when Is Secure is cleared                                                 |
| OctoXLabs connector | management.azure.com      | 443  | HTTPS, or HTTP when Is Secure is cleared (agent pool and machine calls always use HTTPS) |

### Required permissions

| Scope or role                                                                        | Permission | Needed for       |
| ------------------------------------------------------------------------------------ | ---------- | ---------------- |
| Reader role at the subscription scope, or a custom role with the three actions below | Read       | AKS resources    |
| Microsoft.ContainerService/managedClusters/read                                      | Read       | Clusters         |
| Microsoft.ContainerService/managedClusters/agentPools/read                           | Read       | Agent pools      |
| Microsoft.ContainerService/managedClusters/agentPools/machines/read                  | Read       | Machines (nodes) |

Assign the app registration the **Reader** role at the subscription scope, or a custom role with the three actions.

## Create credentials in Azure Kubernetes Service

{% stepper %}
{% step %}

### Create an app registration

In Azure Active Directory, register an application. Copy its Application (Client) ID and the Tenant ID.
{% endstep %}

{% step %}

### Create a client secret

In the app registration open **Certificates & secrets** and create a client secret. Copy the value.
{% endstep %}

{% step %}

### Assign the role

Assign the app registration the **Reader** role at the subscription that contains your AKS clusters. Copy the Subscription ID.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter       | Required | Type    | Default | Description                                                           |
| --------------- | -------- | ------- | ------- | --------------------------------------------------------------------- |
| Tenant ID       | Yes      | String  | None    | Azure AD tenant ID.                                                   |
| Subscription ID | Yes      | String  | None    | Subscription that contains the AKS clusters.                          |
| Client ID       | Yes      | String  | None    | Application (client) ID of the app registration.                      |
| Client Secret   | Yes      | String  | None    | Client secret of the app registration.                                |
| Proxy           | No       | String  | None    | Proxy address. The connector sends requests through `http://<value>`. |
| Is Secure       | No       | Boolean | True    | Use HTTPS. Clear it to use HTTP.                                      |
| Timeout         | No       | Integer | 30      | Time in seconds to wait for API responses.                            |

## Troubleshooting

| Error message                                                          | Cause                                                                  | Fix                                                                                                                                           |
| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Max retries exceeded for                                               | Azure answered 401 or 429 five times in a row.                         | Check the credentials and wait for the rate limit.                                                                                            |
| Status Code: `, followed by the URL, the method and the response body` | The API answered with a status other than the one the adapter expects. | Read the code and body. 401 or 403 usually points to wrong credentials or missing permissions. Check the address, port and Is Secure setting. |

## Change history

{% hint style="info" %}
Available starting from version 6.5.0.
{% endhint %}
