# Connect Akto with Azure App Services

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-a8ccbc6dbcbcb05de0f07c1a2f741fe91011a08a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Introduction

Learn about how to send API traffic data from Azure App Services Web App to Akto.

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-1dabf3c8a02e0d3f50c5b982af8ccff40fcbb9fc%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Prerequisites

1. Your Web App should have sidecar support enabled at the time of creation.

   <figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-bf096dbab4d256197fd50a65ababcf95351abb13%2FSidecarEnabled.png?alt=media" alt="Sidecar Enabled"><figcaption></figcaption></figure>

## Adding Akto traffic collector to Azure App Services Web App

1. Open Azure Portal and click on App Services in the left navbar.

   <figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-e09747e4913fd33bb6d9326281d2219c9c00fddb%2Fapp-services.png?alt=media" alt="App Services"><figcaption></figcaption></figure>
2. Click on the web app for which you want to setup traffic mirroring.
3. Click on Environment Variables under the Settings tab in left navbar.

   <figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-891e99b979bd31643bb2bf9b38d9de156233b650%2Fenv-variables.png?alt=media" alt="Environment Variables"><figcaption></figcaption></figure>
4. Add the following env variables.

```bash
AKTO_INFRA_MIRRORING_MODE=gcp
AKTO_KAFKA_BROKER_MAL=<Akto_Runtime_Load_Balancer_DNS> // modify this value with Akto Runtime Load Balancer DNS
AKTO_MONGO_CONN=mongodb://0.0.0.0:27017
AKTO_TRAFFIC_BATCH_SIZE=100
AKTO_TRAFFIC_BATCH_TIME_SECS=10
```

Click on Apply for the changes to be reflected.

5. Go to your web app, and click on Deployment Center under the Deployment tab in left navbar.

   <figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-9fcca4f26a647f70a0d14ff1d488a9decb5e40d0%2Fdeployment-center.png?alt=media" alt="Deployment Center"><figcaption></figcaption></figure>
6. Click on Add button, and add the akto traffic mirroring sidecar.

   <figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-6b655ad35000bfbe3b2ad50c514a4cf38026f268%2Fadd-container.png?alt=media" alt="Add Container"><figcaption></figcaption></figure>
7. Enter the following values to spawn a new Akto mirroring container

```bash
Name -> mirroring
Image source -> Docker Hub or other registeries
Image Type -> Public
Registry server URL -> index.docker.io
Image and tag -> aktosecurity/mirror-api-logging:k8s_agent
Port -> 90
```

<figure><img src="https://2916937215-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRc4KTKGprZI2sPWKoaLe%2Fuploads%2Fgit-blob-232ed83b98b8cf14feeb5252141876f9d9eadaf7%2Fmirroring-container.png?alt=media" alt="Mirroring Container"><figcaption></figcaption></figure>

8. Click on Apply, and traffic should start population in a couple of minutes.
