Azure App Service

If you are deploying to Azure App Service using a custom Linux container, you can run the Akita CLI within that container to observe your API traffic. The instructions below walk you through the necessary steps.

If you are using Azure App Service to deploy an application from source code, this method is not available. See Generating API Models without Packet Capture for some additional options.

1. Install the Akita CLI in your container

The Akita CLI will run inside the Docker container you build for deploying your application to Azure App Service. Install the Akita CLI during your container build process by running the install script or downloading a package from our repository. See Install on Linux for additional details.

For example, on most Debian-based images, the following command will install the latest version of the Akita CLI:

RUN bash -c "$(curl -L https://releases.akita.software/scripts/install_akita.sh)"

Next, change your container's default command to the Akita CLI. The apidump subcommand lets you run your application's normal startup as a subprocess. The packet capture will run continuously, and stop as soon as your application exits.

Use the project name you have created on the Akita console; see Set up the App for instructions on creating a new project.

CMD ["/usr/local/bin/akita", "apidump", "--service", "<your project name>", \
     "-u", "root", "-c", "<your normal commnand line>", \
     "--rate-limit", "100"]

We recommend starting with a relatively low rate-limit, because this limit is applied to each running container, not to the application as a whole.

📘

Alternatives to modifying the entry point

You can also run the Akita CLI as a background process, if your normal entry point is a script. Run akita apidump --service <your project> in the background, and the Akita CLI will start continuously monitoring all traffic to and from the container.

2. Configure your Akita API key in the App Service configuration

The Akita CLI needs to access your API Key (created in Set up the App) to send traffic to Akita. If it is not able to authenticate with the Akita cloud servers, the CLI will immediately exit.

The best way to set the API key is by an environment variable passed in to the container. In the Azure web interface, you can configure the environment variables by navigating to Settings > Configuration > Application settings. Add new application settings named AKITA_API_KEY_ID and AKITA_API_KEY_SECRET and enter your API key ID and key secret. These values will be securely added to the environment variables in the container.

3. Launch the new container

After adding the Akita API key, build your new container, add it to your normal repository, and restart your application in Azure App Service. This will cause Azure to pull the new version of the container, and the Akita CLI will start sending


Did this page help you?