Skip to content

Commit d6ce532

Browse files
Merge pull request #307416 from SoniaLopezBravo/mqtt-broker-data-persistence
Changes to MQTT persistence
2 parents 133eac8 + 4d738db commit d6ce532

1 file changed

Lines changed: 32 additions & 19 deletions

File tree

articles/iot-operations/manage-mqtt-broker/howto-broker-persistence.md

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.author: sonialopez
66
ms.topic: how-to
77
ms.service: azure-iot-operations
88
ms.subservice: azure-mqtt-broker
9-
ms.date: 07/28/2025
9+
ms.date: 10/27/2025
1010

1111
---
1212

@@ -63,27 +63,40 @@ To configure volume settings in the Azure portal:
6363

6464
# [Azure CLI](#tab/azurecli)
6565

66-
To configure volume settings using Azure CLI, prepare a Broker configuration file in JSON format:
66+
1. To deploy MQTT Broker with the minimum required settings to enable disk persistence, use the `az iot ops create` command.
6767

68-
```json
69-
{
70-
"persistence": {
71-
"maxSize": "10GiB",
72-
"persistentVolumeClaimSpec": {
73-
"storageClassName": "example-storage-class",
74-
"accessModes": [
75-
"ReadWriteOncePod"
76-
]
77-
}
78-
}
79-
}
80-
```
68+
```azurecli
69+
az iot ops create --cluster <CLUSTER_NAME> -g <RESOURCE_GROUP_NAME> --name <INSTANCE_NAME> --sr-resource-id <SCHEMA_REGISTRY_RESOURCE_ID> --ns-resource-id <NAMESPACE_RESOURCE_ID> --persist-max-size 10Gi
70+
```
8171
82-
Then run the [az iot ops create](/cli/azure/iot/ops#az-iot-ops-create) command with the `--broker-config-file` flag to deploy IoT Operations:
72+
1. To deploy MQTT Broker with disk persistence, custom persistent volume claim, and custom persist mode settings, add the `--persist-pvc-sc` and `--persist-mode` flags to the `az iot ops create` command.
8373
84-
```azurecli
85-
az iot ops create --broker-config-file <BROKER_CONFIG_FILE>.json --cluster <CLUSTER_NAME> --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP_NAME> --sr-resource-id <SCHEMA_REGISTRY_RESOURCE_ID>
86-
```
74+
```azurecli
75+
az iot ops create --cluster <CLUSTER_NAME> -g <RESOURCE_GROUP_NAME> --name <INSTANCE_NAME> --sr-resource-id <SCHEMA_REGISTRY_RESOURCE_ID> --ns-resource-id <NAMESPACE_RESOURCE_ID> --persist-max-size 10Gi --persist-pvc-sc <MYSTORAGECLASS> --persist-mode retain=All stateStore=None
76+
```
77+
78+
79+
1. If you want to use a custom broker configuration file, add the `--broker-config-file` flag and include the persistence settings in the JSON file.
80+
81+
```azurecli
82+
az iot ops create --broker-config-file <BROKER_CONFIG_FILE>.json --cluster <CLUSTER_NAME> --name <INSTANCE_NAME> --resource-group <RESOURCE_GROUP_NAME> --sr-resource-id <SCHEMA_REGISTRY_RESOURCE_ID>
83+
```
84+
85+
The following is an example JSON snippet to include in your custom broker configuration file to set up persistence with a maximum size of 10 GiB and a custom storage class.
86+
87+
```json
88+
{
89+
"persistence": {
90+
"maxSize": "10GiB",
91+
"persistentVolumeClaimSpec": {
92+
"storageClassName": "example-storage-class",
93+
"accessModes": [
94+
"ReadWriteOncePod"
95+
]
96+
}
97+
}
98+
}
99+
```
87100
88101
---
89102

0 commit comments

Comments
 (0)