Skip to content

Commit b90dfec

Browse files
committed
Fix authorization bicep
1 parent 7a1c34c commit b90dfec

File tree

1 file changed

+51
-16
lines changed

1 file changed

+51
-16
lines changed

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

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.subservice: azure-mqtt-broker
77
ms.topic: how-to
88
ms.custom:
99
- ignite-2023
10-
ms.date: 10/30/2024
10+
ms.date: 11/02/2024
1111

1212
#CustomerIntent: As an operator, I want to configure authorization so that I have secure MQTT broker communications.
1313
ms.service: azure-iot-operations
@@ -50,18 +50,26 @@ To edit the default endpoint, create a Bicep `.bicep` file with the following co
5050
```bicep
5151
param aioInstanceName string = '<AIO_INSTANCE_NAME>'
5252
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
53+
param policyName string = '<POLICY_NAME>'
5354
5455
resource aioInstance 'Microsoft.IoTOperations/instances@2024-09-15-preview' existing = {
5556
name: aioInstanceName
5657
}
58+
5759
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
5860
name: customLocationName
5961
}
60-
resource BrokerAuthorization 'Microsoft.IoTOperations/instances/brokerAuthorization@2024-09-15-preview' = {
61-
parent: aioInstanceName
62-
name: endpointName
62+
63+
resource defaultBroker 'Microsoft.IoTOperations/instances/brokers@2024-09-15-preview' existing = {
64+
parent: aioInstance
65+
name: 'default'
66+
}
67+
68+
resource brokerAuthorization 'Microsoft.IoTOperations/instances/brokers/authorizations@2024-09-15-preview' = {
69+
parent: defaultBroker
70+
name: policyName
6371
extendedLocation: {
64-
name: customLocationName
72+
name: customLocation.id
6573
type: 'CustomLocation'
6674
}
6775
properties: {
@@ -110,7 +118,7 @@ resource BrokerAuthorization 'Microsoft.IoTOperations/instances/brokerAuthorizat
110118
Deploy the Bicep file using Azure CLI.
111119

112120
```azurecli
113-
az stack group create --name MyDeploymentStack --resource-group <RESOURCE_GROUP> --template-file <FILE>.bicep --dm None --aou deleteResources --yes
121+
az deployment group create --resource-group <RESOURCE_GROUP> --template-file <FILE>.bicep
114122
```
115123

116124
# [Kubernetes](#tab/kubernetes)
@@ -204,18 +212,26 @@ In the **Broker authorization details** for your authorization policy, use the f
204212
```bicep
205213
param aioInstanceName string = '<AIO_INSTANCE_NAME>'
206214
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
215+
param policyName string = '<POLICY_NAME>'
207216
208217
resource aioInstance 'Microsoft.IoTOperations/instances@2024-09-15-preview' existing = {
209218
name: aioInstanceName
210219
}
220+
211221
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
212222
name: customLocationName
213223
}
214-
resource BrokerAuthorization 'Microsoft.IoTOperations/instances/brokerAuthorization@2024-09-15-preview' = {
215-
parent: aioInstanceName
216-
name: endpointName
224+
225+
resource defaultBroker 'Microsoft.IoTOperations/instances/brokers@2024-09-15-preview' existing = {
226+
parent: aioInstance
227+
name: 'default'
228+
}
229+
230+
resource brokerAuthorization 'Microsoft.IoTOperations/instances/brokers/authorizations@2024-09-15-preview' = {
231+
parent: defaultBroker
232+
name: policyName
217233
extendedLocation: {
218-
name: customLocationName
234+
name: customLocation.id
219235
type: 'CustomLocation'
220236
}
221237
properties: {
@@ -253,7 +269,13 @@ resource BrokerAuthorization 'Microsoft.IoTOperations/instances/brokerAuthorizat
253269
}
254270
}
255271
```
256-
272+
273+
Deploy the Bicep file using Azure CLI.
274+
275+
```azurecli
276+
az deployment group create --resource-group <RESOURCE_GROUP> --template-file <FILE>.bicep
277+
```
278+
257279
# [Kubernetes](#tab/kubernetes)
258280

259281
```yaml
@@ -353,23 +375,30 @@ In the **Broker authorization details** for your authorization policy, use the f
353375
```bicep
354376
param aioInstanceName string = '<AIO_INSTANCE_NAME>'
355377
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
378+
param policyName string = '<POLICY_NAME>'
356379
357380
resource aioInstance 'Microsoft.IoTOperations/instances@2024-09-15-preview' existing = {
358381
name: aioInstanceName
359382
}
383+
360384
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
361385
name: customLocationName
362386
}
363-
resource BrokerAuthorization 'Microsoft.IoTOperations/instances/brokerAuthorization@2024-09-15-preview' = {
364-
parent: aioInstanceName
365-
name: endpointName
387+
388+
resource defaultBroker 'Microsoft.IoTOperations/instances/brokers@2024-09-15-preview' existing = {
389+
parent: aioInstance
390+
name: 'default'
391+
}
392+
393+
resource brokerAuthorization 'Microsoft.IoTOperations/instances/brokers/authorizations@2024-09-15-preview' = {
394+
parent: defaultBroker
395+
name: policyName
366396
extendedLocation: {
367-
name: customLocationName
397+
name: customLocation.id
368398
type: 'CustomLocation'
369399
}
370400
properties: {
371401
authorizationPolicies: {
372-
enableCache: false
373402
rules: [
374403
{
375404
principals: {
@@ -404,6 +433,12 @@ resource BrokerAuthorization 'Microsoft.IoTOperations/instances/brokerAuthorizat
404433
405434
```
406435

436+
Deploy the Bicep file using Azure CLI.
437+
438+
```azurecli
439+
az deployment group create --resource-group <RESOURCE_GROUP> --template-file <FILE>.bicep
440+
```
441+
407442
# [Kubernetes](#tab/kubernetes)
408443

409444
```yaml

0 commit comments

Comments
 (0)