The Simplest Way to Make Azure Storage and Keycloak Work Like They Should
Teams pair azure storage and keycloak to manage who can read or write cloud files. This setup lets one central login system control permissions for all your cloud storage buckets. In a standard cloud setup, apps and people need to reach files, blobs, and queues. You want to check each user in one place before they touch any stored data. Linking your login server with your cloud accounts keeps user rules clean and easy to read. How logins and data flow between azure storage and keycloak Keycl
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair azure storage and keycloak to manage who can read or write cloud files. This setup lets one central login system control permissions for all your cloud storage buckets.
In a standard cloud setup, apps and people need to reach files, blobs, and queues. You want to check each user in one place before they touch any stored data. Linking your login server with your cloud accounts keeps user rules clean and easy to read.
How logins and data flow between azure storage and keycloak
Keycloak acts as your main login server and holds all user accounts and group rules. It uses open standards like OpenID Connect and SAML to verify who a person is. When someone logs in, the server checks their password and gives them a signed token.
Azure Storage holds your blobs, file shares, tables, and queues inside the Microsoft cloud. By default, it checks identities through Microsoft Entra ID or shared account keys. To make the two tools work together, you link Keycloak to Entra ID using federation.
Once you set up federation, Entra ID trusts the login tokens from your Keycloak server. A user logs in once, and the cloud platform accepts their identity right away. Then, Azure role assignments decide which storage containers or blobs that user can read.
Apps can also use workload identity federation to trade a Keycloak token for cloud permissions. The app sends its token to the Microsoft identity platform to get a cloud token. It then uses that cloud token to read or write blobs over standard web calls.
Common failure modes and how to scope roles
Many teams skip federation because it takes time to set up across both platforms. Instead, they paste shared storage account keys into app settings or share them in chat. Shared keys give full control over the whole storage account and never expire on their own.
Keycloak + Azure RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If a shared key leaks, anyone can read or delete every file in that account. Even worse, storage logs will not show which person ran the delete command. Every action looks like it came from the same shared master key.
Another common mistake is giving users broad contributor roles at the cloud subscription level. A user who only needs one blob container ends up with rights to every storage account. Broad tokens also stay valid too long if you do not set short token lifespans.
To fix this, turn off shared key access on your storage accounts right away. Force all people and apps to use identity tokens for every storage request. Map your Keycloak groups to narrow cloud roles that cover only a single blob container.
You should also lock down network paths between your apps, users, and storage accounts. Set the storage firewall to block public web traffic and allow only trusted private networks. When you combine tight network rules with narrow roles, you cut down your risk a lot.
Finally, turn on storage diagnostic logs and send them to a central log workspace. Good logs let your team see which user token read or changed a file. Check these logs often to spot weird file reads or failed login tries.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Can Azure Storage read Keycloak tokens without Entra ID?
No, Azure Storage does not trust external login servers on its own. You must link Keycloak to Microsoft Entra ID using identity federation first. Then Entra ID trades the external token for a token that the storage service understands.
How do I stop teams from using shared storage account keys?
You can turn off shared key access in the settings of each storage account. Once you flip that switch, the cloud blocks all requests that use account keys or SAS tokens. Every user and app must then log in with an identity token instead.
What happens if blobs hold sensitive data like emails or card numbers?
Role rules only control who can open a blob, not what is inside the file. If a file holds emails, phone numbers, or card numbers, anyone with read rights sees them. You need data masking tools to rewrite matched fields in results before users read the output.
Related guides
In this post