> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sightlineanalytics.io/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](https://docs.sightlineanalytics.io/authorization.md)
* An existing Azure CDN or Front Door profile
* Azure CLI configured for the target subscription
* Node.js 18+ and npm

> [!NOTE]
>
> Azure CDN diagnostic logs are batched hourly. Expect a **5–60 minute delay** between a CDN request and the pageview appearing in Siteline.

## Setup

**1. Clone and install**

```bash theme={null}
git clone https://github.com/siteline-ai/siteline-azure-cdn.git
cd siteline-azure-cdn
npm install
```

**2. Log in to Azure**

```bash theme={null}
az login
```

**3. 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)

## 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.

**sitelineWebsiteKey** `string` *required*

Your Siteline website key. Used to authenticate requests to the Siteline API.

**cdnProfileResourceId** `string` *required*

The full Azure resource ID of the target CDN or Front Door profile.

**location** `string`

Azure deployment region. Defaults to `eastus`.

**storageAccountName** `string`

Storage account name. Defaults to `sitelineazurecdnlogs`. Must be globally unique.

**functionAppName** `string`

Function App name. Defaults to `siteline-azure-cdn-processor`.

**logContainerName** `string`

Blob container name for CDN logs. Defaults to `cdn-logs`.

**sitelineEndpoint** `string`

Siteline intake endpoint. Defaults to `https://api.siteline.ai/v1/intake/pageview`.

**sitelineDebug** `boolean`

Enables verbose logging in the Function App. Defaults to `false`.

## 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

> [accordion] 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] 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] 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] 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] LocationNotAvailableForResourceGroup with Global region
>
> The setup wizard auto-resolves this. If it persists, specify a concrete region like `eastus` in the `location` parameter.

> [accordion] 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] 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.

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.