Azure Cost Tracking Setup

Connect Microsoft Azure to track infrastructure costs in Paygent. Paygent uses the Azure Cost Management Query API with a service principal (app registration).

What You’ll Need: An Azure subscription on a supported offer (Pay-As-You-Go, EA, or Microsoft Customer Agreement), an Entra ID app registration, and Cost Management Reader + Reader on the subscription.


Step 1 — Register an app (service principal)

  1. Go to Microsoft Entra IDApp registrationsNew registration
  2. Name it (e.g. Paygent Cost Reader) and register
  3. Note the Application (client) ID and Directory (tenant) ID
  4. Under Certificates & secrets, create a Client secret and copy it once

Step 2 — Grant subscription access

Assign roles to the service principal (Enterprise application), not your user account:

  1. Open Subscriptions → your subscription
  2. Access control (IAM)Add role assignment
  3. Add Reader
  4. Add Cost Management Reader

Step 3 — Connect in Paygent

  1. In Paygent go to SettingsInfra CostAzure
  2. Enter account name, Tenant ID, Client ID, Client secret, and Subscription ID
  3. Save — Paygent verifies subscription access and stores credentials securely

Billing latency & supported offers

  • Cost data can lag 8–24 hours after resources start running
  • Free Trial / Sponsorship subscriptions often do not support Cost Management APIs — upgrade to Pay-As-You-Go if Cost Analysis fails in the Azure portal
  • New Azure Plan subscriptions may need up to 48 hours before Cost Management returns data

Troubleshooting

SymptomLikely cause
Auth succeeds but Cost query returns 404Offer not supported, or billing not provisioned yet
403 on subscriptionMissing Reader / Cost Management Reader on the service principal
$0 in Paygent but VM is runningNormal lag — check Cost analysis in Azure portal first