> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siteline.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure CDN

> Integrate Siteline with Azure CDN or Front Door diagnostic logs

Use the Siteline Azure CDN Log Processor to track Azure CDN or Front Door traffic with Siteline. This integration processes CDN diagnostic logs from Blob Storage, triggers on blob-created events via Event Grid, and forwards pageview events to the Siteline API — no application code changes required.

## Prerequisites

* A [Siteline website key](/authorization)
* An existing Azure CDN or Front Door profile
* Azure CLI configured for the target subscription
* Node.js 18+ and npm

<Info>
  Azure CDN diagnostic logs are batched hourly. Expect a **5–60 minute delay** between a CDN request and the pageview appearing in Siteline.
</Info>

## Setup

<Steps>
  <Step title="Clone and install">
    ```bash theme={null}
    git clone https://github.com/siteline-ai/siteline-azure-cdn.git
    cd siteline-azure-cdn
    npm install
    ```
  </Step>

  <Step title="Log in to Azure">
    ```bash theme={null}
    az login
    ```
  </Step>

  <Step title="Run the setup wizard">
    ```bash theme={null}
    npm run setup
    ```

    The interactive wizard will:

    * Prompt for your Siteline website key
    * List available CDN / Front Door profiles in your subscription
    * Provision all required Azure resources via Bicep (storage account, Function App, Event Grid subscription, diagnostic settings)
  </Step>
</Steps>

## How it works

This integration uses Diagnostic Settings, Blob Storage, Event Grid, and Azure Functions:

```text theme={null}
Azure CDN / Front Door (diagnostic logs)
  -> Blob Storage (cdn-logs container)
  -> Event Grid (BlobCreated)
  -> Azure Function (processor)
  -> Siteline intake API
```

Processing flow:

1. Azure CDN or Front Door writes hourly log batches to Blob Storage via Diagnostic Settings.
2. Blob Storage emits `BlobCreated` events to Event Grid.
3. Event Grid triggers the Azure Function processor.
4. The Function downloads and decompresses the log blob.
5. The Function parses records, normalizes fields across all CDN SKUs (Standard Microsoft, Standard/Premium Verizon, Front Door Standard/Premium), and sends pageview events to Siteline with 10 concurrent requests and 3 retries.

Failed events are routed to a dead-letter queue (`dlq` container) for inspection.

## Configuration

All settings are defined in `infra/main.bicepparam` and can be edited directly before running setup.

<ResponseField name="sitelineWebsiteKey" type="string" required>
  Your Siteline website key. Used to authenticate requests to the Siteline API.
</ResponseField>

<ResponseField name="cdnProfileResourceId" type="string" required>
  The full Azure resource ID of the target CDN or Front Door profile.
</ResponseField>

<ResponseField name="location" type="string">
  Azure deployment region. Defaults to `eastus`.
</ResponseField>

<ResponseField name="storageAccountName" type="string">
  Storage account name. Defaults to `sitelineazurecdnlogs`. Must be globally unique.
</ResponseField>

<ResponseField name="functionAppName" type="string">
  Function App name. Defaults to `siteline-azure-cdn-processor`.
</ResponseField>

<ResponseField name="logContainerName" type="string">
  Blob container name for CDN logs. Defaults to `cdn-logs`.
</ResponseField>

<ResponseField name="sitelineEndpoint" type="string">
  Siteline intake endpoint. Defaults to `https://api.siteline.ai/v1/intake/pageview`.
</ResponseField>

<ResponseField name="sitelineDebug" type="boolean">
  Enables verbose logging in the Function App. Defaults to `false`.
</ResponseField>

## Deploying updates

After initial setup, redeploy function code with:

```bash theme={null}
npm run deploy
```

This rebuilds, packages, and deploys the Function App interactively, prompting for resource group and function app with saved defaults.

## Troubleshooting

<AccordionGroup>
  <Accordion title="az: command not found">
    Install the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) and ensure it is available on your `PATH`.
  </Accordion>

  <Accordion title="No CDN profiles found">
    Verify you are logged into the correct Azure subscription. You can also enter the CDN profile resource ID manually when prompted.
  </Accordion>

  <Accordion title="Storage account name already taken">
    Storage account names are globally unique. Edit `storageAccountName` in `infra/main.bicepparam` with a unique name and rerun setup.
  </Accordion>

  <Accordion title="RBAC permission error during setup">
    Role assignments can take 1–2 minutes to propagate. Wait briefly and rerun `npm run setup` — Bicep deployments are idempotent.
  </Accordion>

  <Accordion title="LocationNotAvailableForResourceGroup with Global region">
    The setup wizard auto-resolves this. If it persists, specify a concrete region like `eastus` in the `location` parameter.
  </Accordion>

  <Accordion title="No pageviews appearing in Siteline">
    Diagnostic logs are batched hourly — wait up to 60 minutes after initial setup. If pageviews still don't appear, check the `dlq` blob container for failed events.
  </Accordion>

  <Accordion title="How do I change configuration after setup?">
    Edit parameters directly in `infra/main.bicepparam` and rerun `npm run setup`. The Bicep deployment is idempotent and will update resources in place.
  </Accordion>
</AccordionGroup>

<Tip>
  **Need help?** [Book a setup call](https://cal.com/team/siteline/tech-set-up) and we'll walk you through it.
</Tip>
