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
+273-1Lines changed: 273 additions & 1 deletion
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/11/2024
10
+
ms.date: 04/28/2025
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,6 +43,64 @@ The following example shows how to create a BrokerAuthorization resource by usin
43
43
44
44
:::image type="content" source="media/howto-configure-authorization/authorization-rules.png" alt-text="Screenshot that shows using the Azure portal to create broker authorization rules.":::
45
45
46
+
# [Azure CLI](#tab/cli)
47
+
48
+
Use the [az iot ops broker authz apply](/cli/azure/iot/ops/broker/authz#az-iot-ops-broker-authz-apply) command to create or change an authorization policy.
To edit an authorization policy, create a `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
@@ -217,6 +275,59 @@ In the broker authorization rules for your authorization policy, use the followi
217
275
]
218
276
```
219
277
278
+
# [Azure CLI](#tab/cli)
279
+
280
+
Use the [az iot ops broker authz apply](/cli/azure/iot/ops/broker/authz#az-iot-ops-broker-authz-apply) command to create or change an authorization policy.
In the broker authorization rules for your authorization policy, create a configuration file named `client-id-policy.json` with the following configuration stored in the user's home directory:
To edit an authorization policy, create a `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
@@ -382,6 +493,64 @@ In the broker authorization rules for your authorization policy, use the followi
382
493
]
383
494
```
384
495
496
+
# [Azure CLI](#tab/cli)
497
+
498
+
Use the [az iot ops broker authz apply](/cli/azure/iot/ops/broker/authz#az-iot-ops-broker-authz-apply) command to create or change an authorization policy.
To edit an authorization policy, create a `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
@@ -514,6 +683,22 @@ Include the `stateStoreResources` section in the rules for your authorization po
514
683
]
515
684
```
516
685
686
+
# [Azure CLI](#tab/cli)
687
+
688
+
Include the `stateStoreResources` section in the rules for your authorization policy.
689
+
690
+
```json
691
+
"stateStoreResources": [
692
+
{
693
+
"method": "", // Values: read, write, readwrite
694
+
"keyType": "", //Values: string, pattern, binary. Default is pattern
695
+
"keys": [
696
+
// List of patterns to match
697
+
]
698
+
},
699
+
]
700
+
```
701
+
517
702
# [Bicep](#tab/bicep)
518
703
519
704
In Bicep, include the `stateStoreResources` section in your authorization policy.
@@ -643,6 +828,79 @@ In the broker authorization rules for your authorization policy, add a similar c
643
828
]
644
829
```
645
830
831
+
# [Azure CLI](#tab/cli)
832
+
833
+
In this example, assume a configuration file named `state-store-authz-policy.json` in the user's home directory. In the broker authorization rules for your authorization policy, add a similar configuration:
To edit an authorization policy, create a `.bicep` file with the following content. Update the settings as needed, and replace the placeholder values like `<AIO_INSTANCE_NAME>` with your own.
1. Select the broker listener you want to edit from the list.
775
1033
1. On the port where you want to disable authorization, select **None** in the authorization dropdown.
776
1034
1035
+
# [Azure CLI](#tab/cli)
1036
+
1037
+
Use the [az iot ops broker listener port add](/cli/azure/iot/ops/broker/listener#az-iot-ops-broker-listener-port-add) command to disable authorization for a port. To disable authentication, don't include the `--authz-ref` parameter.
1038
+
1039
+
```azurecli
1040
+
az iot ops broker listener port add --resource-group <ResourceGroupName> --instance <AioInstanceName> --broker default --listener <ListenerName> --port <ListenerServicePort>
1041
+
```
1042
+
1043
+
The following example disables authorization for port 8884 to the listener named `aio-broker-loadbalancer`:
1044
+
1045
+
```azurecli
1046
+
az iot ops broker listener port add --resource-group myResourceGroupName --instance myAioInstanceName --broker default --listener aio-broker-loadbalancer --authn-ref default --port 8884
1047
+
```
1048
+
777
1049
# [Bicep](#tab/bicep)
778
1050
779
1051
To disable authorization, omit `authorizationRef` in the `ports` setting of your BrokerListener resource.
0 commit comments