Skip to content

Commit 5daeaa7

Browse files
Venkata YaddanapudiVenkata Yaddanapudi
authored andcommitted
mqtt-qs and other changes
1 parent b8ff1e3 commit 5daeaa7

8 files changed

+87
-52
lines changed
36.6 KB
Loading
14.4 KB
Loading
160 KB
Loading

articles/event-grid/mqtt-event-grid-namespace-terminology.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,61 @@ Key terms relevant for Event Grid namespace and MQTT resources are explained.
1313

1414
## Namespace
1515

16-
An Event Grid namespace is a declarative space that provides a scope to all the nested resources or subresources such as topics, certificates, clients, client groups, topic spaces, permission bindings. It gives you a unique FQDN.
16+
An Event Grid namespace is a declarative space that provides a scope to all the nested resources or subresources such as topics, certificates, clients, client groups, topic spaces, permission bindings.
1717

18-
Namespace is a tracked resource with 'tags' and a 'location' properties, and once created can be found on resources.azure.com.
18+
| Resource | Protocol supported |
19+
| :--- | :---: |
20+
| Namespace topics | HTTP |
21+
| Topic Spaces | MQTT |
22+
| Clients | MQTT |
23+
| Client Groups | MQTT |
24+
| CA Certificates | MQTT |
25+
| Permission bindings | MQTT |
1926

2027
Using the namespace, you can organize the subresources into logical groups and manage them as a single unit in your Azure subscription. Deleting a namespace deletes all the subresources encompassed within the namespace.
2128

29+
It gives you a unique FQDN. A Namespace exposes two endpoints:
30+
31+
- An HTTP endpoint to support general messaging requirements using Namespace Topics.
32+
- An MQTT endpoint for IoT messaging or solutions that use MQTT.
33+
34+
A Namespace also provides DNS-integrated network endpoints and a range of access control and network integration management features such as IP ingress filtering and private links. It's also the container of managed identities used for all contained resources that use them.
35+
36+
Namespace is a tracked resource with 'tags' and a 'location' properties, and once created can be found on resources.azure.com.
37+
2238
The name of the namespace can be 3-50 characters long. It can include alphanumeric, and hyphen(-), and no spaces. The name needs to be unique per region.
2339

2440
## Client
2541

26-
Client is a device or an application that can publish and/or subscribe MQTT messages.
42+
Client is a device or an application that can publish and/or subscribe MQTT messages. For more information about client configuration, see [MQTT clients](mqtt-clients.md).
2743

2844
## Certificate / Cert
2945

30-
Certificate is a form of asymmetric credential. They're a combination of a public key from an asymmetric keypair and a set of metadata describing the valid uses of the keypair. If the keypair of the issuer is the same keypair as the certificate, the certificate is said to be "self-signed". Third-party certificate issuers are sometimes called Certificate Authorities (CA).
46+
Certificate is a form of asymmetric credential. They're a combination of a public key from an asymmetric keypair and a set of metadata describing the valid uses of the keypair. If the keypair of the issuer is the same keypair as the certificate, the certificate is said to be "self-signed". Third-party certificate issuers are sometimes called Certificate Authorities (CA). For more information about client authentication, see [MQTT client authentication](mqtt-client-authentication.md).
3147

3248
## Client attributes
3349

34-
Client attributes represent a set of key-value pairs that provide descriptive information about the client. Client attributes are used in creating client groups and as variables in Topic Templates. For example, client type is an attribute that provides the client's type.
50+
Client attributes represent a set of key-value pairs that provide descriptive information about the client. Client attributes are used in creating client groups and as variables in Topic Templates. For example, client type is an attribute that provides the client's type. For more information about client configuration, see [MQTT clients](mqtt-clients.md).
3551

3652
## Client group
3753

38-
Client group is a collection of clients. Clients can be grouped together using common client attribute(s). Client groups can be given permissions to publish and/or subscribe to a specific topic space.
54+
Client group is a collection of clients. Clients can be grouped together using common client attribute(s). Client groups can be given permissions to publish and/or subscribe to a specific topic space. For more information about client groups configuration, see [MQTT client groups](mqtt-client-groups.md).
3955

4056
## Topic space
4157

42-
Topic space is a set of topic templates. It's used to simplify access control management by enabling you to grant publish or subscribe access to a group of topics at once instead of individual topics.
58+
Topic space is a set of topic templates. It's used to simplify access control management by enabling you to grant publish or subscribe access to a group of topics at once instead of individual topics. For more information about topic spaces configuration, see [MQTT topic spaces](mqtt-topic-spaces.md).
4359

4460
## Topic filter
4561

4662
An MQTT topic filter is an MQTT topic that can include wildcards for one or more of its segments, allowing it to match multiple MQTT topics. It's used to simplify subscriptions declarations as one topic filter can match multiple topics.
4763

4864
## Topic template
4965

50-
Topic templates are an extension of the topic filter that supports variables. It's used for fine-grained access control within a client group.
66+
Topic templates are an extension of the topic filter that supports variables. It's used for fine-grained access control within a client group.
5167

5268
## Permission bindings
5369

54-
A Permission Binding grants access to a specific client group to either publish or subscribe on a specific topic space.
70+
A Permission Binding grants access to a specific client group to either publish or subscribe on a specific topic space. For more information about permission bindings, see [MQTT access control](mqtt-access-control.md).
5571

5672
## Throughput units
5773

articles/event-grid/mqtt-publish-and-subscribe-cli.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ Save the Namespace object in namespace.json file in resources folder.
6363
"properties": {
6464
"inputSchema": "CloudEventSchemaV1_0",
6565
"topicSpacesConfiguration": {
66-
"state": "Enabled",
67-
}
66+
"state": "Enabled"
67+
},
68+
"isZoneRedundant": true
6869
},
6970
"location": "{Add region name}"
7071
}
@@ -85,22 +86,21 @@ Store the client object in client1.json file. Update the allowedThumbprints fie
8586

8687
```json
8788
{
88-
"properties": {
89-
"state": "Enabled",
90-
"authenticationName": “client1-authnID",
91-
"clientCertificateAuthentication": {
92-
"allowedThumbprints": [
93-
"{Your client 1 certificate thumbprint}"
94-
]
95-
}
89+
"state": "Enabled",
90+
"authenticationName": "client1-authnID",
91+
"clientCertificateAuthentication": {
92+
"validationScheme": "ThumbprintMatch",
93+
"allowedThumbprints": [
94+
"{Your client 1 certificate thumbprint}"
95+
]
9696
}
9797
}
9898
```
9999

100100
Use the az resource command to create the first client. Update the command with your subscription ID, Resource group ID, and a Namespace name.
101101

102102
```azurecli-interactive
103-
az resource create --resource-type Microsoft.EventGrid/namespaces/clients --id /subscriptions/{Subscription ID}/resourceGroups/{Resource Group}/providers/Microsoft.EventGrid/namespaces/{Namespace Name}/clients/{Client Name} --is-full-object --api-version 2023-06-01-preview --properties @./resources/client1.json
103+
az resource create --resource-type Microsoft.EventGrid/namespaces/clients --id /subscriptions/{Subscription ID}/resourceGroups/{Resource Group}/providers/Microsoft.EventGrid/namespaces/{Namespace Name}/clients/{Client Name} --api-version 2023-06-01-preview --properties @./resources/client1.json
104104
```
105105

106106
> [!NOTE]
@@ -113,18 +113,16 @@ Store the below object in topicspace.json file.
113113

114114
```json
115115
{
116-
"properties": {
117-
"topicTemplates": [
118-
"contosotopics/topic1"
119-
]
120-
}
116+
"topicTemplates": [
117+
"contosotopics/topic1"
118+
]
121119
}
122120
```
123121

124122
Use the az resource command to create the topic space. Update the command with your subscription ID, Resource group ID, namespace name, and a topic space name.
125123

126124
```azurecli-interactive
127-
az resource create --resource-type Microsoft.EventGrid/namespaces/topicSpaces --id /subscriptions/{Subscription ID}/resourceGroups/{Resource Group}/providers/Microsoft.EventGrid/namespaces/{Namespace Name}/topicSpaces/{Topic Space Name} --is-full-object --api-version 2023-06-01-preview --properties @./resources/topicspace.json
125+
az resource create --resource-type Microsoft.EventGrid/namespaces/topicSpaces --id /subscriptions/{Subscription ID}/resourceGroups/{Resource Group}/providers/Microsoft.EventGrid/namespaces/{Namespace Name}/topicSpaces/{Topic Space Name} --api-version 2023-06-01-preview --properties @./resources/topicspace.json
128126
```
129127

130128
## Create PermissionBindings
@@ -133,11 +131,9 @@ Store the first permission binding object in permissionbinding1.json file. Repl
133131

134132
```json
135133
{
136-
"properties": {
137-
"clientGroupName": "$all",
138-
"permission": "Publisher”,
139-
"topicSpaceName": "{Your topicspace name}"
140-
}
134+
"clientGroupName": "$all",
135+
"permission": "Publisher",
136+
"topicSpaceName": "{Your topicspace name}"
141137
}
142138
```
143139

@@ -151,11 +147,9 @@ Store the second permission binding object in permissionbinding2.json file. Rep
151147

152148
```json
153149
{
154-
"properties": {
155-
"clientGroupName": "$all",
156-
"permission": "Subscriber”,
157-
"topicSpaceName": "{Your topicspace name}"
158-
}
150+
"clientGroupName": "$all",
151+
"permission": "Subscriber",
152+
"topicSpaceName": "{Your topicspace name}"
159153
}
160154
```
161155

@@ -177,6 +171,9 @@ You need to install the MQTTnet package (version 4.1.4.563) from NuGet to run th
177171
178172
**Sample C# code to connect a client, publish/subscribe MQTT message on a topic**
179173

174+
> [!IMPORTANT]
175+
> Please update the client certificate and key pem file paths depending on location of your client certificate files. Also, ensure the client authentication name, topic information match with your configuration.
176+
180177
```csharp
181178
using MQTTnet.Client;
182179
using MQTTnet;
@@ -193,7 +190,8 @@ var mqttClient = new MqttFactory().CreateMqttClient();
193190

194191
var connAck = await mqttClient!.ConnectAsync(new MqttClientOptionsBuilder()
195192
.WithTcpServer(hostname, 8883)
196-
.WithClientId(clientId).WithCredentials(“client1-authnID”, "") //use client authentication name in the username
193+
.WithClientId(clientId)
194+
.WithCredentials("client1-authnID", "") //use client authentication name in the username
197195
.WithTls(new MqttClientOptionsBuilderTlsParameters()
198196
{
199197
UseTls = true,

articles/event-grid/mqtt-publish-and-subscribe-portal.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,30 @@ If you don't already have a certificate, you can create a sample certificate usi
123123
1. For publish / subscribe MQTT messages, you can use any of your favorite tools. For demonstration purpose, publish / subscribe is shown using MQTTX app, which can be downloaded from https://mqttx.app/.
124124
125125
:::image type="content" source="./media/mqtt-publish-and-subscribe-portal/mqttx-app-add-client.png" alt-text="Screenshot showing MQTTX app left rail to add new client.":::
126-
2. Configure client1 with
126+
127+
1. Configure client1 with
127128
- Name as client-name-1 (this value can be anything)
128129
- Client ID as client1-sessionID1 (Client ID in CONNECT packet is used to identify the session ID for the client connection)
129130
- Username as client1-authnID (Username must match the client authentication name in client metadata)
130-
3. Update the host name to MQTT hostname from the Overview page of the namespace.
131+
132+
1. Update the host name to MQTT hostname from the Overview page of the namespace.
131133
132134
:::image type="content" source="./media/mqtt-publish-and-subscribe-portal/event-grid-namespace-overview.png" alt-text="Screenshot showing Event Grid namespace overview page, which has MQTT hostname.":::
133135
134-
4. Toggle SSL/TLS to ON.
135-
5. You can leave the SSL Secure ON.
136-
6. Select Certificate as Self signed.
137-
7. Provide the path to client.cer.pem file for Client Certificate File.
138-
8. Provide the path to client.key.pem file for Client key file.
139-
9. Rest of the settings can be left with predefined default values.
136+
1. Update the port to 8883
137+
1. Toggle SSL/TLS to ON.
138+
1. Toggle SSL Secure to ON, to ensure service certificate validation.
139+
1. Select Certificate as Self signed.
140+
1. Provide the path to client.cer.pem file for Client Certificate File.
141+
1. Provide the path to client.key.pem file for Client key file.
142+
1. Rest of the settings can be left with predefined default values.
140143
141144
:::image type="content" source="./media/mqtt-publish-and-subscribe-portal/mqttx-app-client1-configuration-1.png" alt-text="Screenshot showing client 1 configuration part 1 on MQTTX app.":::
142145
143146
:::image type="content" source="./media/mqtt-publish-and-subscribe-portal/mqttx-app-client1-configuration-2.png" alt-text="Screenshot showing client 1 configuration part 2 on MQTTX app.":::
144147
145-
10. Select Connect to connect the client to the Event Grid MQTT service.
146-
11. Repeat the above steps to connect the second client “client2”, with corresponding authentication information as shown.
148+
1. Select Connect to connect the client to the Event Grid MQTT service.
149+
1. Repeat the above steps to connect the second client “client2”, with corresponding authentication information as shown.
147150
148151
:::image type="content" source="./media/mqtt-publish-and-subscribe-portal/mqttx-app-client2-configuration-1.png" alt-text="Screenshot showing client 2 configuration part 1 on MQTTX app.":::
149152

articles/event-grid/mqtt-routing-to-event-hubs-cli.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ az eventgrid event-subscription create --name contosoEventSubscription \
7171
"topicSpacesConfiguration": {
7272
"state": "Enabled",
7373
"routeTopicResourceId": "/subscriptions/{Subscription ID}/resourceGroups/{Resource Group ID}/providers/Microsoft.EventGrid/topics/{EG Custom Topic Name}"
74-
}
74+
},
75+
"isZoneRedundant": true
7576
},
7677
"location": "{region name}"
7778
}

0 commit comments

Comments
 (0)