Skip to content

Commit 0c5f848

Browse files
committed
Add username clarification
1 parent 41ff1e7 commit 0c5f848

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

articles/iot-operations/manage-mqtt-broker/howto-configure-authorization.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ resource brokerAuthorization 'Microsoft.IoTOperations/instances/brokers/authoriz
9696
{
9797
method: 'Publish'
9898
topics: [
99-
'/telemetry/{principal.username}'
99+
'/telemetry/{principal.clientId}'
100100
'/telemetry/{principal.attributes.organization}'
101101
]
102102
}
@@ -144,7 +144,7 @@ spec:
144144
- method: Connect
145145
- method: Publish
146146
topics:
147-
- "/telemetry/{principal.username}"
147+
- "/telemetry/{principal.clientId}"
148148
- "/telemetry/{principal.attributes.organization}"
149149
- method: Subscribe
150150
topics:
@@ -166,6 +166,14 @@ This broker authorization allows clients with usernames `temperature-sensor` or
166166
- `temperature-sensor` can subscribe to `/commands/contoso`.
167167
- `some-other-username` can subscribe to `/commands/contoso`.
168168

169+
### Using username for authorization
170+
171+
Here's a summary of how the username is used for authorization based on the authentication method:
172+
173+
- **Kubernetes SAT** - Username shouldn't be used for authorization because is not verified for MQTTv5 with enhanced authentication.
174+
- **x.509** - Username matches the CN from certificate and can be used for authorization rules.
175+
- **Custom** - Username should only be used for authorization rules if custom authentication validates the username.
176+
169177
### Further limit access based on client ID
170178

171179
Because the `principals` field is a logical OR, you can further restrict access based on client ID by adding the `clientIds` field to the `brokerResources` field. For example, to allow clients with client IDs that start with its building number to connect and publish telemetry to topics scoped with their building, use the following configuration:
1.29 KB
Loading

0 commit comments

Comments
 (0)