Skip to content

Commit 1263134

Browse files
author
Jill Grant
authored
Merge pull request #256079 from veyaddan/vy-1024-main
updates for built-in rbac roles
2 parents 89efbb2 + 8961469 commit 1263134

File tree

1 file changed

+18
-87
lines changed

1 file changed

+18
-87
lines changed

articles/event-grid/mqtt-client-azure-ad-token-and-rbac.md

Lines changed: 18 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
title: Microsoft Entra JWT authentication and RBAC authorization for clients with Microsoft Entra identity
33
description: Describes JWT authentication and RBAC roles to authorize clients with Microsoft Entra identity to publish or subscribe MQTT messages
44
ms.topic: conceptual
5-
ms.date: 8/11/2023
5+
ms.date: 10/24/2023
66
author: veyaddan
77
ms.author: veyaddan
88
---
99

1010
# Microsoft Entra JWT authentication and Azure RBAC authorization to publish or subscribe MQTT messages
11+
1112
You can authenticate MQTT clients with Microsoft Entra JWT to connect to Event Grid namespace. You can use Azure role-based access control (Azure RBAC) to enable MQTT clients, with Microsoft Entra identity, to publish or subscribe access to specific topic spaces.
1213

14+
1315
> [!IMPORTANT]
14-
> This feature is supported only when using MQTT v5
16+
> This feature is supported only when using MQTT v5 protocol version
1517
1618
## Prerequisites
1719
- You need an Event Grid namespace with MQTT enabled. Learn about [creating Event Grid namespace](/azure/event-grid/create-view-manage-namespaces#create-a-namespace)
18-
- Review the process to [create a custom role](/azure/role-based-access-control/custom-roles-portal)
19-
2020

2121
<a name='authentication-using-azure-ad-jwt'></a>
2222

@@ -44,100 +44,30 @@ Authenticate Reason Code with value 25 signifies reauthentication.
4444
> Audience: “aud” claim must be set to "https://eventgrid.azure.net/".
4545
4646
## Authorization to grant access permissions
47-
A client using Microsoft Entra ID based JWT authentication needs to be authorized to communicate with the Event Grid namespace. You can create custom roles to enable the client to communicate with Event Grid instances in your resource group, and then assign the roles to the client. You can use following two data actions to provide publish or subscribe permissions, to clients with Microsoft Entra identities, on specific topic spaces.
47+
A client using Microsoft Entra ID based JWT authentication needs to be authorized to communicate with the Event Grid namespace. You can assign the following two built-in roles to provide either publish or subscribe permissions, to clients with Microsoft Entra identities.
4848

49-
**Topic spaces publish** data action
50-
Microsoft.EventGrid/topicSpaces/publish/action
49+
- Use **EventGrid TopicSpaces Publisher** role to provide MQTT message publisher access
50+
- Use **EventGrid TopicSpaces Subscriber** role to provide MQTT message subscriber access
5151

52-
**Topic spaces subscribe** data action
53-
Microsoft.EventGrid/topicSpaces/subscribe/action
52+
You can use these roles to provide permissions at subscription, resource group, Event Grid namespace or Event Grid topicspace scope.
53+
54+
## Assigning the publisher role to your Microsoft Entra identity at topicspace scope
5455

55-
> [!NOTE]
56-
> Currently, we recommend using custom roles with the actions provided.
57-
58-
### Custom roles
59-
60-
You can create custom roles using the publish and subscribe actions.
61-
62-
The following are sample role definitions that allow you to publish and subscribe to MQTT messages. These custom roles give permissions at topic space scope. You can also create roles to provide permissions at subscription, resource group scope.
63-
64-
**EventGridMQTTPublisherRole.json**: MQTT messages publish operation.
65-
66-
```json
67-
{
68-
"roleName": "Event Grid namespace MQTT publisher",
69-
"description": "Event Grid namespace MQTT message publisher role",
70-
"assignableScopes": [
71-
"/subscriptions/<subscription ID>/resourceGroups/<resource group name>/Microsoft.EventGrid/namespaces/<namespace name>/topicSpaces/<topicspace name>"
72-
],
73-
"permissions": [
74-
{
75-
"actions": [],
76-
"notActions": [],
77-
"dataActions": [
78-
"Microsoft.EventGrid/topicSpaces/publish/action"
79-
],
80-
"notDataActions": []
81-
}
82-
]
83-
}
84-
```
85-
86-
**EventGridMQTTSubscriberRole.json**: MQTT messages subscribe operation.
87-
88-
```json
89-
{
90-
"roleName": "Event Grid namespace MQTT subscriber",
91-
"description": "Event Grid namespace MQTT message subscriber role",
92-
"assignableScopes": [
93-
"/subscriptions/<subscription ID>/resourceGroups/<resource group name>/Microsoft.EventGrid/namespaces/<namespace name>/topicSpaces/<topicspace name>"
94-
]
95-
"permissions": [
96-
{
97-
"actions": [],
98-
"notActions": [],
99-
"dataActions": [
100-
"Microsoft.EventGrid/topicSpaces/subscribe/action"
101-
],
102-
"notDataActions": []
103-
}
104-
]
105-
}
106-
```
107-
108-
## Create custom roles
109-
1. Navigate to topic spaces page in your Event Grid namespace
110-
1. Select the topic space for which the custom RBAC role needs to be created
111-
1. Navigate to the Access control (IAM) page within the topic space
112-
1. In the Roles tab, right select any of the roles to clone a new custom role. Provide the custom role name.
113-
1. Switch the Baseline permissions to **Start from scratch**
114-
1. On the Permissions tab, select **Add permissions**
115-
1. In the selection page, find and select Microsoft Event Grid
116-
:::image type="content" source="./media/mqtt-client-azure-ad-token-and-rbac/event-grid-custom-role-permissions.png" lightbox="./media/mqtt-client-azure-ad-token-and-rbac/event-grid-custom-role-permissions.png" alt-text="Screenshot showing the Microsoft Event Grid option to find the permissions.":::
117-
1. Navigate to Data Actions
118-
1. Select **Topic spaces publish** data action and select **Add**
119-
:::image type="content" source="./media/mqtt-client-azure-ad-token-and-rbac/event-grid-custom-role-permissions-data-actions.png" lightbox="./media/mqtt-client-azure-ad-token-and-rbac/event-grid-custom-role-permissions-data-actions.png" alt-text="Screenshot showing the data action selection.":::
120-
1. Select Next to see the topic space in the Assignable scopes tab. You can add other assignable scopes if needed.
121-
1. Select **Create** in Review + create tab to create the custom role.
122-
1. Once the custom role is created, you can assign the role to an identity to provide the publish permission on the topic space. You can learn how to assign roles [here](/azure/role-based-access-control/role-assignments-portal).
123-
124-
<a name='assign-the-custom-role-to-your-azure-ad-identity'></a>
125-
126-
## Assign the custom role to your Microsoft Entra identity
12756
1. In the Azure portal, navigate to your Event Grid namespace
128-
1. Navigate to the topic space to which you want to authorize access.
129-
1. Go to the Access control (IAM) page of the topic space
57+
1. Navigate to the topicspace to which you want to authorize access.
58+
1. Go to the Access control (IAM) page of the topicspace
13059
1. Select the **Role assignments** tab to view the role assignments at this scope.
13160
1. Select **+ Add** and Add role assignment.
132-
1. On the Role tab, select the role that you created in the previous step.
133-
1. On the Members tab, select User, group, or service principal to assign the selected role to one or more service principals (applications).
61+
1. On the Role tab, select the "EventGrid TopicSpaces Publisher" role.
62+
1. On the Members tab, for **Assign access to**, select User, group, or service principal option to assign the selected role to one or more service principals (applications).
13463
- Users and groups work when user/group belong to fewer than 200 groups.
135-
1. Select **Select members**.
64+
1. Select **+ Select members**.
13665
1. Find and select the users, groups, or service principals.
66+
1. Select **Next**
13767
1. Select **Review + assign** on the Review + assign tab.
13868

13969
> [!NOTE]
140-
> You can follow similar steps to create and assign a custom Event Grid MQTT subscriber permission to a topic space.
70+
> You can follow similar steps to assign the built-in EventGrid TopicSpaces Subscriber role at topicspace scope.
14171
14272
## Next steps
14373
- See [Publish and subscribe to MQTT message using Event Grid](mqtt-publish-and-subscribe-portal.md)
@@ -146,3 +76,4 @@ The following are sample role definitions that allow you to publish and subscrib
14676
- To learn more about Azure Identity client library, you can refer to [using Azure Identity client library](/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-the-azure-identity-client-library)
14777
- To learn more about implementing an interface for credentials that can provide a token, you can refer to [TokenCredential Interface](/java/api/com.azure.core.credential.tokencredential)
14878
- To learn more about how to authenticate using Azure Identity, you can refer to [examples](https://github.com/Azure/azure-sdk-for-java/wiki/Azure-Identity-Examples)
79+
- If you prefer to use custom roles, you can review the process to [create a custom role](/azure/role-based-access-control/custom-roles-portal)

0 commit comments

Comments
 (0)