You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-operations/manage-mqtt-broker/howto-configure-authorization.md
+267-5Lines changed: 267 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ms.subservice: azure-mqtt-broker
7
7
ms.topic: how-to
8
8
ms.custom:
9
9
- ignite-2023
10
-
ms.date: 11/02/2024
10
+
ms.date: 11/08/2024
11
11
12
12
#CustomerIntent: As an operator, I want to configure authorization so that I have secure MQTT broker communications.
13
13
ms.service: azure-iot-operations
@@ -43,7 +43,7 @@ The following example shows how to create a *BrokerAuthorization* resource using
43
43
44
44
# [Bicep](#tab/bicep)
45
45
46
-
To edit the default endpoint, create a Bicep `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
46
+
To edit an authorization policy, create a Bicep `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
@@ -170,7 +170,7 @@ Because the `principals` field is a logical OR, you can further restrict access
170
170
171
171
# [Portal](#tab/portal)
172
172
173
-
In the **Broker authorization details** for your authorization policy, use the following configuration:
173
+
In the broker authorization rules for your authorization policy, use the following configuration:
174
174
175
175
```json
176
176
[
@@ -207,6 +207,8 @@ In the **Broker authorization details** for your authorization policy, use the f
207
207
208
208
# [Bicep](#tab/bicep)
209
209
210
+
To edit an authorization policy, create a Bicep `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
@@ -331,7 +333,7 @@ As the application has an authorization attribute called `authz-sat`, there's no
331
333
332
334
# [Portal](#tab/portal)
333
335
334
-
In the **Broker authorization details** for your authorization policy, use the following configuration:
336
+
In the Broker authorization rules for your authorization policy, use the following configuration:
335
337
336
338
```json
337
339
[
@@ -370,6 +372,8 @@ In the **Broker authorization details** for your authorization policy, use the f
370
372
371
373
# [Bicep](#tab/bicep)
372
374
375
+
To edit an authorization policy, create a Bicep `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
@@ -475,7 +479,265 @@ To set up authorization for clients that use the DSS, provide the following perm
475
479
- Permission to publish to the system key value store `$services/statestore/_any_/command/invoke/request` topic
476
480
- Permission to subscribe to the response-topic (set during initial publish as a parameter) `<response_topic>/#`
477
481
478
-
For more information about DSS authorization, see [state store keys](https://github.com/Azure/iotedge-broker/blob/main/docs/authorization/readme.md#state-store-keys).
482
+
### State store keys
483
+
484
+
The state store is accessed over the MQTT broker on topic `statestore/v1/FA9AE35F-2F64-47CD-9BFF-08E2B32A0FE8/command/invoke`.
485
+
Since clients have access to the topic, you can specify keys and access levels under the `stateStoreResources` section of the MQTT broker `brokerResources` configuration.
486
+
487
+
The `stateStoreResources` section format consists of access level, a pattern indicator, and the pattern.
488
+
489
+
# [Portal](#tab/portal)
490
+
491
+
Include the `stateStoreResources` section in the rules for your authorization policy.
492
+
493
+
```json
494
+
"stateStoreResources": [
495
+
{
496
+
"method": "", // Values: read, write, readwrite
497
+
"keyType": "", //Values: string, pattern, binary. Default is pattern
498
+
"keys": [
499
+
// List of patterns to match
500
+
]
501
+
},
502
+
]
503
+
```
504
+
505
+
# [Bicep](#tab/bicep)
506
+
507
+
In Bicep, include the `stateStoreResources` section in your authorization policy.
508
+
509
+
```bicep
510
+
stateStoreResources: [
511
+
{
512
+
method: '' // Values: read, write, readwrite
513
+
keyType: '' //Values: string, pattern, binary. Default is pattern
514
+
keys: [
515
+
// List of patterns to match
516
+
]
517
+
}
518
+
{
519
+
method: 'ReadWrite'
520
+
keyType: 'Binary'
521
+
keys: [
522
+
'xxxxxxxxxxxxxxxxxxxx'
523
+
]
524
+
}
525
+
]
526
+
```
527
+
528
+
# [Kubernetes](#tab/kubernetes)
529
+
530
+
In your custom resource definition, include the `stateStoreResources` section in your authorization policy.
531
+
532
+
``` yaml
533
+
stateStoreResources:
534
+
- method: # Values: read, write, readwrite
535
+
keyType: # Values: string, pattern, binary. Default is pattern
536
+
keys:
537
+
- # List of patterns to match
538
+
```
539
+
540
+
---
541
+
542
+
The `method` field specifies the access level.
543
+
- Read access is specified with `read`, write access with `write`, and both with `readwrite`.
544
+
- Access level is required.
545
+
- Read access level implies the actions of `get` and `keynotify`.
546
+
- Write access level implies the actions of `set`, `del`, and `vdel`.
547
+
548
+
The `keyType` field specifies the type of key matching.
549
+
- `pattern`to use *glob* style pattern matching
550
+
- `string`to do exact match, for example when a key contains characters that might be otherwise matched as a pattern (`*`, `?`, `[0-9]`)
551
+
- `binary`to match a binary key
552
+
553
+
The `keys` field specifies the keys to match. The keys can be specified as *Glob* style patterns, token substitutions, or exact strings.
554
+
- *Glob* style examples:
555
+
- `colors/*`: All keys under the "colors/" prefix
556
+
- `number[0-9]`: Any key from "number0" to "number9"
557
+
- `char?`: Any key with prefix "char" and a single digit suffix, like "charA"
558
+
- `*`: Full access to all keys.
559
+
- State store keys also support token substitution when key type is `pattern` and curly braces are reserved for this purpose. Token substitution examples:
560
+
- `clients/{principal.clientId}/*`
561
+
- `usernames/{principal.username}/*`
562
+
- `rooms/{principal.attributes.room}/*`
563
+
564
+
Here's an example of how you might author your state store resources:
565
+
566
+
# [Portal](#tab/portal)
567
+
568
+
In the Broker authorization rules for your authorization policy, add a similar configuration:
To edit an authorization policy, create a Bicep `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
0 commit comments