An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
Hello Anouk,
When using Microsoft Entra ID (JWT-based authentication) with Event Grid Topic Spaces, the behavior is a bit different compared to certificate-based authentication. Specifically, client.attributes are not available when authenticating via JWT tokens, so you won’t be able to attach attributes (like enterprise or site) directly to the app registration and reference them in topic templates.
What can be done instead?
With JWT authentication, Event Grid evaluates claims present in the token. So the recommended approach is to move from client.attributes to token claims.
Recommended approach: Use custom JWT claims
You can include attributes such as enterprise and site as claims in the access token, and then reference them in your Topic Space templates.
High-level steps:
Configure your app registration (or token issuance process) to include custom claims such as:
enterprise
site
Ensure these claims are present in the JWT token obtained via the client credentials flow.
Update your Topic Space template to use claims instead of attributes, for example:
${client.claims.enterprise}/${client.claims.site}/+/+
This achieves the same logical isolation you had before, ensuring each client can only publish/subscribe within its own enterprise/site scope.
Alternative options (if claims are not feasible)
Per-tenant app registrations:
You could create separate app registrations per enterprise/site and structure topic templates using the client ID. This is simpler but may not scale well.
RBAC alone is not sufficient:
While roles like EventGrid TopicSpaces Publisher/Subscriber allow clients to connect, they do not restrict access to specific topics. Topic-level isolation must still be enforced via templates.
Summary
client.attributes are only available with certificate-based authentication, not with JWT.
With Entra ID, claims in the token are the correct mechanism for passing tenant-specific context.
The recommended design is to include enterprise/site as claims and use them in Topic Space templates.
Please accept as answer and do a Thumbs-up to upvote this response if you are satisfied with the community help. Your upvote will be beneficial for the community users facing similar issues.