Skip to main content

Azure

Causely provides native integration with the Azure API to retrieve relevant information about your cloud environment. To set up this integration, you need a Service Principal (SPN) with Reader permissions on the subscriptions you want to monitor.

Step 1: Create a Service Principal (SPN)

Use the following azure-cli command to create an SPN:

az ad sp create-for-rbac --name causely-spn --role reader --scopes /subscriptions/00000000-0000-0000-0000-000000000000

Step 2: Create a Kubernetes Secret for the SPN Credentials

After creating the SPN, save its credentials in a Kubernetes Secret. Replace the placeholder values with the SPN's tenantId, clientId, clientSecret, and subscriptionId.

kubectl --namespace causely create secret generic spn-credentials \
--from-literal=tenantId="..." \
--from-literal=clientId="..." \
--from-literal=clientSecret="..." \
--from-literal=subscriptionId="..."

Step 3: Update Causely Configuration

Once the Secret is created, update the Causely configuration to enable scraping for the new subscription. Below is an example configuration:

scrapers:
azure: # Scrape VMs & Disks
enabled: true
subscriptions:
- secretName: spn-credentials
namespace: causely

azurePostgres: # Scrape Postgresql Databases
enabled: true
subscriptions:
- secretName: spn-credentials
namespace: causely

azureMysql: # Scrape Mysql Databases
enabled: true
subscriptions:
- secretName: spn-credentials
namespace: causely

azureRedis: # Scrape Redis
enabled: true
subscriptions:
- secretName: spn-credentials
namespace: causely

azureEventhub: # Scrape EventHub
enabled: true
subscriptions:
- secretName: spn-credentials
namespace: causely

Alternative: Enable Credentials Autodiscovery

Causely also supports credentials autodiscovery. This feature allows you to add new scraping targets without updating the Causely configuration. Simply label the Kubernetes Secret to enable autodiscovery for the corresponding scraper.

Example: Labeling Secrets for Autodiscovery

# Azure VMs & Disks
kubectl --namespace causely label secret spn-credentials "causely.ai/scraper=Azure"

# Azure Postgresql
kubectl --namespace causely label secret spn-credentials "causely.ai/scraper=AzurePostgres"

# Azure MySQL
kubectl --namespace causely label secret spn-credentials "causely.ai/scraper=AzureMysql"

# Azure Redis
kubectl --namespace causely label secret spn-credentials "causely.ai/scraper=AzureRedis"

# Azure EventHub
kubectl --namespace causely label secret spn-credentials "causely.ai/scraper=AzureEventHub"

With these steps, you can seamlessly integrate Causely with the Azure API and configure it to monitor your desired resources.