Why teams run Loki on AKS with Blob Storage
An Azure-hosted platform team that needs centralized logs in infrastructure it controls can run Grafana Loki on Azure Kubernetes Service (AKS) with Azure Blob Storage. In this setup, Loki writes compressed log chunks and its index to a storage account in your own Azure subscription, so the data never leaves your tenancy. The federated token method is the production-oriented way to authenticate Loki to that storage, instead of a connection string with a hard-coded account key. This page covers the workload identity setup, the role assignment on the storage account, gateway authentication in front of Loki and the retention settings that decide how long logs are kept.
Loki documents three deployment modes: monolithic (a single binary, up to about 20 GB of logs per day), simple scalable, and microservices for very large clusters. Simple scalable mode is being deprecated and will be removed with the Loki 4.0 release, so teams starting now should plan around monolithic or microservices mode and confirm the current guidance in the Loki deployment modes documentation before choosing. Blob Storage is one of the recommended production object stores for Loki, alongside Amazon S3 and Google Cloud Storage. Your daily log volume and query load decide which mode fits, and the sizing page in this group explains how to make that call.
Choosing how Loki authenticates to Azure
A connection string packs the storage account name, account key or shared access signature into one value that Loki reads from its configuration. It is the simplest method to set up because it needs no identity objects in Entra ID and no changes to the cluster's identity configuration. The trade-off is that the value is a long-lived secret that must be stored somewhere Loki can read it, usually a Kubernetes Secret, and anyone who can read that Secret can use the storage account. The Grafana guide for Loki on Azure treats this approach as less suitable for production than federated tokens.
- Secret rotation: Rotating the account key means updating every consumer and restarting Loki components that read it, so rotation is a manual, coordinated change.
- Where credentials live: The secret sits in configuration or a Kubernetes Secret, which is stored unencrypted in etcd unless encryption at rest is configured.
- How pods get identity: Pods do not have an identity of their own. Any pod with the secret mounted can act as the storage account.
- Audit trail: Storage access logs show the account key, not a specific workload, which makes attribution harder.
- Setup effort: Minimal, which can suit a proof of concept but needs a deliberate exit plan before production.
Before you choose this method, confirm with your security team whether a long-lived storage key is permitted in your environment and who can read Kubernetes Secrets in the Loki namespace.
A service principal is an application identity in Microsoft Entra ID. Loki authenticates as that identity using a client ID and a client secret or certificate, and the identity is granted a role on the storage account. This gives you a named, role-scoped identity that is separate from the storage account key. The credential is still a secret that the cluster must hold, so the operational problem moves from the storage key to the client secret.
- Secret rotation: The client secret has an expiry you set when it is created, so rotation is scheduled and can be done without changing the storage account key.
- Where credentials live: The client secret or certificate is stored in the cluster or a vault that the cluster can reach, and must be protected like any other credential.
- How pods get identity: All pods using the same credential share one identity, so you cannot distinguish Loki components in storage logs.
- Scope control: Role assignments can be limited to the containers Loki needs, which narrows the blast radius of a leaked secret.
- Ownership: Someone must own the application registration and its expiry calendar after the deployment is complete.
Check how your organization manages app registrations and secret expiry before choosing this option, because a missed expiry stops log writes.
A managed identity is an identity that Azure creates and manages for a resource, so no client secret needs to be issued or stored by you. When Loki runs on a virtual machine or a service that supports managed identities, the platform issues short-lived tokens to that resource. On AKS, the identity is attached to node pools or the cluster, so every pod scheduled on those nodes shares the same identity unless you add a finer mechanism. The Loki Helm on Azure guide lists managed identity as one of the supported options.
- Secret rotation: Azure rotates the underlying credential, so there is no secret for your team to schedule or store.
- Where credentials live: No secret is stored in the cluster. Access depends on the identity assignment on the node or resource.
- How pods get identity: Node-level identity means any pod on that node can use the same role, which is broader than a pod-level identity.
- Isolation limits: Separating Loki from other workloads on the same nodes requires dedicated node pools or additional controls.
- Migration cost: Moving later to pod-level identity means reworking role assignments and node configuration.
Confirm with your platform team whether node-level identity is acceptable for shared clusters and whether Loki will run on dedicated node pools.
Federated token authentication, usually called workload identity on AKS, lets a Kubernetes service account exchange its projected token for an Entra ID token. The pod holds no stored secret. The cluster issues the service account token, Entra ID trusts the cluster's OpenID Connect issuer through a federated credential, and the resulting access token is scoped to the role you assigned. The Grafana guide uses this method and describes it as more suitable for production than a hard-coded connection string.
- Secret rotation: There is no long-lived secret to rotate. Tokens are short-lived and issued automatically.
- Where credentials live: Nothing sensitive is stored in Loki's configuration. The trust relationship lives in Entra ID and the cluster's issuer settings.
- How pods get identity: Each service account can map to its own identity, so you can give the Loki components different roles and read them apart in audit logs.
- Setup requirements: The cluster must expose an OIDC issuer and workload identity must be enabled, and the federated credential must match the namespace and service account name exactly.
- Operations: A mismatched subject in the federated credential is the most common cause of failed authentication, so verify it first when a component cannot write.
Before building, confirm with your cluster administrator that the AKS cluster supports workload identity in your region and Kubernetes version, using current Azure documentation.
How a Loki pod reaches Blob Storage with a federated token
The request starts at a Loki pod whose service account carries a projected token issued by the AKS cluster issuer. That token is exchanged with Microsoft Entra ID for an access token scoped to the storage account, so no storage key or connection string sits in the cluster. Loki components then call Azure Blob Storage directly, while the authenticating gateway handles only client traffic from outside the cluster. Check that the trust boundary between the cluster and Entra ID is configured with the correct issuer and subject, and that the identity holds only the storage role it needs.
Token flow from the AKS cluster through Entra ID to Blob Storage.
Setting up workload identity for Loki on AKS
This sequence takes an AKS cluster from no identity setup to a Loki installation that writes chunks and index data to Azure Blob Storage with a federated token, not a storage account key or connection string. Each step ends with a check so you can confirm it before moving on.
Prepare the AKS cluster for workload identity
The cluster platform team enables the OIDC issuer and workload identity on the AKS cluster, either at creation or on an existing cluster through the Azure CLI. These settings let Kubernetes service account tokens be exchanged for Azure AD tokens. Record the cluster's OIDC issuer URL, because the federated credential in a later step must reference it exactly. Check that the cluster reports the OIDC issuer as enabled and that workload identity is active before continuing. Confirm the current
az aksflags and the workload identity add-on or webhook behavior in the Azure documentation for your cluster version, since these change over time.Create the storage account and container
Create an Azure storage account and a blob container for Loki chunks and index data, in the region and redundancy tier your data residency and resilience requirements call for. Keep public blob access disabled and confirm that shared key access is set according to your policy, because the federated token method does not depend on account keys. Record the account name, container name and resource group for the Helm values. Check the container exists and that the account's network rules allow traffic from the AKS node subnets. The Loki Helm on Azure guide describes the expected storage settings, so compare your choices against it.
Create the managed identity and federated credential
Create a user-assigned managed identity for Loki in Azure, then add a federated identity credential that trusts the AKS OIDC issuer and binds to the Kubernetes service account Loki runs under. The subject must match the namespace and service account name in your Helm release exactly, so agree those names with the team deploying Loki before creating the credential. If you run more than one Loki component with its own service account, decide whether they share one identity or get separate ones. Check the credential lists the correct issuer and subject. Confirm the required
az identityand federated credential parameters in the current Azure documentation.Assign the blob data role at the storage scope
Grant the managed identity a Storage Blob Data role that allows reading, writing and deleting blobs, scoped to the storage account or the specific container rather than the subscription. Loki needs to delete data when retention runs, so a read-only role will not be enough for the compactor path. A role assignment at a narrow scope limits what a compromised pod could reach. Assign the role with an identity owner who has permission to create role assignments. Check the assignment in the portal or CLI and confirm the exact built-in role name against the current Azure role documentation before you apply it.
Install the Loki Helm chart with Azure storage values
Install the Loki Helm chart with values that point the object store at Azure Blob Storage, set the storage account and container names, and enable workload identity on the Loki service accounts using the client ID of the managed identity and the expected pod labels. Set the schema and index configuration to match your Loki version, and keep authentication settings consistent with your gateway plan. Use the Helm chart values documented for your chart version rather than copying keys from older examples. Check the release reaches a ready state, that the pods have the projected token volume and environment variables injected, and that the Loki pods start without storage errors in their logs.
Verify pods write chunks to blob storage
Send a test log stream through your collector, or push a small sample with the Loki push API, then list the container contents in Azure to confirm that chunk and index objects appear under the expected prefixes. Check the ingester and distributor logs for authentication or permission errors, which usually point to a subject mismatch or a missing role. Confirm that no storage account key or connection string was added to any secret or values file. The write path is only verified once blobs appear from the Loki pods using the federated identity.
Confirm a query returns the test data
Run a LogQL query for the test stream in Grafana or with the Loki query API, using the tenant header if authentication is enabled, and confirm the sample lines come back with the expected labels. Querying verifies that the querier can read the objects, which is a separate permission path from the write path. If the query returns no data, check the time range, the stream labels and the querier logs before changing identity settings. Record the working query and the identity configuration as your baseline for future upgrades and retention changes.
Retention, gateway and deployment options and when each fits
This table compares the four decisions that shape a Loki deployment on AKS: deployment mode, retention, gateway authentication and tenancy. Read each row as a choice with a trade-off, and check the right-hand column against your log volume and team size before you write Helm values.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Deployment mode | Simple scalable | Being deprecated and removed with Loki 4.0, so new AKS builds should not start here | Only for existing clusters that will migrate before Loki 4.0 |
| Deployment mode | Monolithic (single binary) | Simplest to run, but limited to about 20 GB of logs per day per the Loki docs | Evaluation or small volumes that stay well under that ceiling |
| Deployment mode | Microservices | More components and Helm values to operate, with separate read, write and backend scaling | Large volumes or teams that need independent scaling and a path past simple scalable |
| Retention | retention_enabled left false | Logs are kept indefinitely and blob storage cost grows with them | Never a good default: confirm retention with your compliance owner before go-live |
| Retention | Global or per-tenant rules set with retention_enabled true | One policy for the whole cluster, or separate periods per tenant, applied by the compactor | Single-team clusters, or multi-tenant clusters with uniform retention requirements |
| Retention | Per-stream selector rules | Finer control over sensitive or high-volume streams; each rule must be at least 24 hours | Mixed requirements, such as shorter retention for debug logs and longer for audit logs |
| Gateway authentication | Authenticating reverse proxy (nginx, HAProxy, OAuth2 Proxy or Pomerium) | An extra component to deploy, certificate and identity-provider setup to maintain, and a single point to secure | Any cluster reachable by users or collectors, since Loki has no built-in authentication |
| Tenancy | auth_enabled false | One implicit tenant with no separation between teams or environments | Single-team evaluation where all users may read all logs |
| Tenancy | auth_enabled true with X-Scope-OrgID | Tenant separation and per-tenant limits, but every writer and reader must send the correct header | Multiple teams, customers or environments sharing one Azure Blob Storage account |
Security controls for Loki on AKS
Running Loki on AKS with Blob Storage puts log data, storage credentials and tenant boundaries in one place. The cards below cover the controls that connect the identity, network and cluster layers, and the checks to run before the cluster takes production logs.
Least-privilege role assignment at container scope
Grant the Loki workload identity a storage data role on the single blob container that holds Loki chunks and index, not on the storage account or subscription. Confirm the exact role names with the Azure documentation for your tenant, and review who else holds rights on the account. Check that the assignment is written down in your infrastructure code so a reviewer can trace which identity can read and delete log data.
Loki Azure guideNo stored keys or connection strings
A storage account key or connection string in a Kubernetes Secret gives full account access to anyone who can read that Secret, and it does not expire on its own. The federated token method removes the static credential: the pod's service account token is exchanged for an Azure token. Check that no storage key appears in Helm values, the chart repository or CI variables, and that rotation of any remaining key is scheduled.
Gateway enforces authentication
Loki has no built-in authentication layer, so the push and query endpoints accept any request that reaches them unless something in front of them checks identity. Place an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of the gateway, and make sure no Service of type LoadBalancer exposes Loki's port directly. Test that an unauthenticated request is refused from outside the cluster.
Encryption at rest for Kubernetes Secrets
Kubernetes stores Secrets unencrypted in etcd by default. Any remaining Secrets in the Loki namespace, such as gateway credentials or client certificates, are readable by anyone with access to etcd backups. Confirm with your AKS configuration whether etcd encryption is enabled, restrict list and watch access on Secrets with least-privilege RBAC, and consider an external store through the Secrets Store CSI Driver.
Secrets good practicesPod Security Standards for Loki namespaces
Loki components do not need privileged containers, host networking or host paths. Apply the Pod Security Standards restricted profile to the Loki namespace where your Helm chart permits it, and run containers as non-root with a read-only root filesystem where the chart supports it. Test the chart in a non-production namespace first, because some components may need a writable volume for caches or temporary files.
Pod Security StandardsTenant isolation with X-Scope-OrgID
When auth_enabled is true, Loki separates data by the tenant ID carried in the X-Scope-OrgID header. That header is only a label, so the gateway must set or validate it from the authenticated identity; otherwise a client can send another tenant's ID and read its logs. Verify with two test users that each one can query only its own tenant, and document which team owns the mapping from identity to tenant.
Questions teams ask before deploying Loki on AKS
How much does a Loki deployment on AKS cost and what drives the price?
The total depends on the cluster, the Azure Blob Storage consumption, the engineering time to configure identity and retention, and the support you keep afterward. The cluster and storage are paid to Azure on consumption, so their size follows your daily log volume and how long you keep data. Engineering is a one-time cost for workload identity, role assignments, gateway authentication and testing. Ongoing costs recur for node capacity, storage growth, upgrades and support. DeployOpen does not publish a price list. Ask for a quote built from a written scope that names the environments, data volumes, retention periods and whether support is included. No Azure price figure is given on this page, so confirm current rates with Azure and your own log volume.
How long does a Loki on AKS setup take?
Duration depends on how much of the environment already exists and how many decisions remain open. Teams with a working AKS cluster, an identified storage account and clear retention rules move faster than teams that still need to agree on tenancy, identity and network access. The main drivers are the number of Azure subscriptions and identities involved, whether a federated token setup must be approved by your cloud governance team, how many log sources must be connected, and how much testing your compliance owners want before go-live. A fixed-scope engagement sets the timeline in writing before work starts. Ask for the milestones, the client dependencies and the acceptance tests in that document.
Can our internal team deploy Loki on AKS without outside help?
Yes, if your team already runs Kubernetes and Azure in production. The Loki documentation includes an Azure deployment guide for the Helm chart, and it covers federated token authentication as the production-oriented option. Your team will need working knowledge of AKS, Helm values, Azure role assignments, Kubernetes service accounts, and Loki's storage, retention and gateway settings. Most gaps show up in identity setup and in the difference between a working test install and a hardened production one. Before committing, have an engineer walk through the Azure guide in a non-production cluster and list any skill gaps. Those gaps tell you whether to train, hire or bring in a partner for specific tasks.
Do we need Azure and Kubernetes access, or a sandbox first?
A sandbox first is the lower-risk route for most teams. A non-production AKS cluster and a separate storage account let you test workload identity, role assignment, retention and gateway authentication without touching live log data. Production work needs access to the subscription, the cluster, the identity provider and the networking that the gateway depends on. Access should be scoped to the named people and roles in the statement of work, with audit logging enabled. Ask the vendor which accounts and roles they need, how credentials are handled, and whether they will work in your tenant or a copy of it. Confirm these points with your Azure governance owner before any access is granted.
Why use federated tokens instead of a storage connection string?
Federated tokens avoid storing a long-lived storage account key in the Loki configuration or in a Kubernetes Secret. The Loki Azure guide notes that it considers federated tokens more suitable for production than a hard-coded connection string. Loki can also authenticate with a service principal or a managed identity, so the choice depends on what your Azure identity model allows. Connection strings are simpler to set up but give broad access to anyone who can read the secret. Ask your security team how the identity will be granted only the Blob Storage permissions Loki needs, how rotation is handled, and how access is reviewed.
What should we ask for in a fixed-scope quote?
Ask for a written scope that lists each deliverable and the environment it applies to. The quote should name the AKS cluster and Kubernetes version, the Azure subscriptions and storage accounts, the identity method and role assignments, the gateway authentication design, the retention rules by tenant or stream, and the Loki deployment mode used. It should also state the acceptance tests, the documentation handed over, the client responsibilities and what happens to any change request. Confirm whether ongoing support, upgrades and testing are included or offered as a separate retainer. Ask which items are one-time and which recur, so you can compare the quote with your own team's cost.
What breaks most often when Loki runs on AKS with Blob Storage?
The most common faults are identity and permission errors, where the workload cannot reach the Blob container, and gateway errors, where requests reach Loki without the expected tenant header or authentication. Retention is another frequent source of surprise. Loki retention is disabled by default, so logs are kept until retention is turned on in the compactor configuration. Check that identity works, that the gateway requires authentication, that the X-Scope-OrgID header is set for each tenant, and that retention matches your policy before loading production data. Document these checks so operations staff can repeat them after upgrades.
Decision path from proof of concept to production on AKS
The path starts with expected daily log volume, which decides whether a single binary or the simple scalable mode fits, and notes that simple scalable is being deprecated, so teams planning beyond a proof of concept should check the deployment mode docs before committing. Next, the Azure authentication choice: the federated token method is preferred for production over a hard-coded connection string. Retention and tenancy settings come after, because retention is off by default and tenant IDs shape access. The path ends at the authenticating gateway and a verification pass before go-live.
The decisions to settle, in order, before a Loki on AKS setup goes to production.
How DeployOpen scopes and delivers Loki on AKS
DeployOpen plans, builds, documents and supports self-hosted Loki inside your own Azure subscriptions, so the storage, identity and retention choices stay under your control. Each engagement starts with a written scope that names the AKS clusters, storage accounts and tenants involved before any configuration changes are made.
How we scope
- We confirm the AKS version, node pools, region and the Azure subscriptions where Loki will run
- We agree which Blob Storage accounts, containers and managed identities Loki will use for chunks and index
- We record retention periods, tenant boundaries and gateway authentication requirements in the written scope before work starts
How we build
- We configure workload identity federation, role assignments and the Loki Helm values in a non-production cluster first
- We verify that Loki writes and reads chunks through federated tokens and that no connection string is stored in the cluster
- We test the authenticating gateway, confirm X-Scope-OrgID handling and check that compactor retention behaves as agreed
How we hand over
- You receive the Helm values, Azure role assignment records and workload identity configuration as versioned files
- The runbook covers the retention settings, the compactor schedule, storage access checks and the upgrade steps your team will follow
- Your engineers walk through a verification checklist with us so they can confirm the deployment on their own
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts
- Ongoing support, Loki upgrades and continuous testing are available as a retainer
- Quotes follow from the written scope, and we confirm the Loki and Kubernetes versions you plan to run before each upgrade

