Simple roles.
Precise permissions.

Granite turns Entra ID app roles into fine-grained permissions for your APIs: Azure Functions and ASP.NET Core REST APIs alike. Your roles stay readable in Entra; your APIs decide on every operation, down to a single invoice.

Try it: pick the caller's role

Permissions resolved by Granite

      App roles stop scaling when your application grows.

      One role per operation and Entra ID becomes unreadable: dozens of roles per API, bloated tokens, and every tweak goes through the identity team.

      Too few roles and your code fills up with hard-coded checks nobody dares to touch. Granite separates the two: roles stay coarse in Entra, permissions live in a matrix you change without redeploying.

      What happens on every call

      1. The token arrives

        The middleware validates the Entra ID access token (signature, issuer, audience, expiry) and reads its roles, whether the caller is a user or an application.

      2. Permissions are resolved

        For each role, it asks Granite using the application's managed identity, then keeps the answer in memory for a few minutes. Most calls never leave the instance.

      3. The code decides

        An attribute blocks what must be blocked up front (403). For everything else, the code reads its permissions and decides entity by entity: this department, this confidential invoice, this amount.

      Two levels, one line of setup

      The [RequirePermission] attribute handles general access control. The injected IPermissionContext handles decisions that depend on the data.

      Permissions used in the code are published automatically at startup, so the console only offers permissions that actually exist.

      Azure Functions
      public sealed class InvoiceFunctions(IPermissionContext perms)
      {
          [Function("GetInvoice")]
          [RequirePermission("invoices.read")]   // otherwise: 403
          public IActionResult Get(HttpRequest req, string id)
          {
              var invoice = repo.Find(id);
      
              if (invoice.Confidential
                  && !perms.Has("invoices.read.confidential"))
                  return GraniteResults.Forbidden();
      
              return new OkObjectResult(invoice);
          }
      }
      ASP.NET Core REST API (minimal API)
      app.MapGet("/api/items/{id}",
              (string id, IPermissionContext perms) => ...)
         .RequirePermission("inventory.read");   // otherwise: 403

      A matrix, not a config file

      The console lists your APIs and their app roles, imported straight from Entra ID. Tick a box, save: your APIs pick up the change when their cache expires. Every change is logged with its author.

      Installable as an app (PWA), signed in with Entra ID, restricted to administrators.

      PermissionReaderApproverAdmin
      invoices.read✓✓◐
      invoices.read.confidential✓◐
      invoices.approve✓◐
      invoices.approve.unlimited◐
      invoices.*✓
      ◐: covered by the invoices.* wildcard

      Built to fail on the safe side

      Nothing travels in headers
      Permissions live in the invocation context. A caller cannot inject them.
      Deny by default
      If Granite is unreachable, the last known value serves for a limited time, then the call is refused (503). Never granted.
      Each API sees only its own permissions
      An application can only read the matrix of its own API: no enumerating the others.
      No secrets
      Managed identities everywhere: to Granite, to Cosmos DB, to Microsoft Graph.
      Full audit trail
      Who granted what, to which role, and when. Additions and removals are both kept.
      Stable tokens
      Permissions aren't in the token: no token bloat, and changes apply without signing in again.

      Deployed in your tenant, in one command

      The Terraform module creates the app registrations, Cosmos DB, Function Apps on Flex Consumption, the console, managed identities and their rights. It all fits in Azure's free tiers to get started.

      # infra/
      terraform init
      terraform apply -var="custom_domain=example.com"
      
      # then
      ./scripts/deploy.sh

      Frequently asked questions

      Why not put everything in app roles?

      Because Entra ID isn't built for hundreds of roles per API, and a role change requires signing in again. Granite keeps a few business roles in Entra and moves the detail into a matrix you can change on the fly.

      Does it work for app-to-app calls?

      Yes. Application tokens (client credentials, managed identities) also carry a roles claim; the middleware treats them exactly like user tokens.

      How long before a change takes effect?

      At most the cache duration: five minutes by default, configurable per application. It's the trade-off between responsiveness and call volume.

      Which languages are supported?

      The .NET middleware supports Azure Functions (isolated worker) and ASP.NET Core REST APIs hosted on App Service, Container Apps or AKS. The service also exposes a simple HTTP API you can call from any other language.

      Where is my data?

      In your Azure subscription, in the region you choose. Granite sends nothing anywhere else.

      Let's talk about your permissions

      A demo, a question about the architecture or about deploying in your tenant? Write to us. We usually reply within one business day.