Skip to content

Commit 18e0d20

Browse files
committed
Updated Entra sections
1 parent 0c423f3 commit 18e0d20

5 files changed

+54
-6
lines changed

includes/iot-hub-howto-connect-service-iothub-entra-dotnet.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ ms.date: 11/06/2024
1212
ms.custom: mqtt, devx-track-csharp, devx-track-dotnet
1313
---
1414

15-
Use [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) to use Microsoft Entra to authenticate a connection to IoT Hub. `DefaultAzureCredential` supports different authentication mechanisms and determines the appropriate credential type based of the environment it's executing in. It attempts to use multiple credential types in an order until it finds a working credential. For more information on setting up Entra for IoT Hub, see [Control access to IoT Hub by using Microsoft Entra ID](/azure/iot-hub/authenticate-authorize-azure-ad).
15+
##### Entra token credential
16+
17+
Use [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) to use Microsoft Entra to authenticate a connection to IoT Hub. `DefaultAzureCredential` supports different authentication mechanisms and determines the appropriate credential type based on the environment it's executing in. It attempts to use multiple credential types in an order until it finds a working credential. For more information on setting up Entra for IoT Hub, see [Control access to IoT Hub by using Microsoft Entra ID](/azure/iot-hub/authenticate-authorize-azure-ad).
1618

1719
To create required Microsoft Entra app parameters for `DefaultAzureCredential`, create a Microsoft Entra app registration that contains your preferred authentication mechanism:
1820

@@ -22,8 +24,12 @@ To create required Microsoft Entra app parameters for `DefaultAzureCredential`,
2224

2325
For more information, see [Quickstart: Register an application with the Microsoft identity platform](/entra/identity-platform/quickstart-register-app).
2426

27+
#### Entra app permissions
28+
2529
Microsoft Entra apps may require permissions depending on operations performed. For example, [IoT Hub Twin Contributor](/azure/role-based-access-control/built-in-roles/internet-of-things#iot-hub-twin-contributor) is required to enable read and write access to a IoT Hub device and module twins. For more information, see [Azure built-in roles](/azure/role-based-access-control/built-in-roles#internet-of-things).
2630

31+
### Connect to IoT Hub
32+
2733
Add these packages and statements to your code to use the Microsoft Entra library.
2834

2935
Packages:

includes/iot-hub-howto-connect-service-iothub-entra-node.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,21 @@ For an overview of Node.js SDK authentication, see:
1616
* [Getting started with user authentication on Azure](/azure/developer/javascript/how-to/with-authentication/getting-started)
1717
* [Azure Identity client library for JavaScript](/javascript/api/overview/azure/identity-readme)
1818

19-
### Entra token credential
19+
##### Entra token credential
2020

2121
Use [DefaultAzureCredential](/javascript/api/@azure/identity/defaultazurecredential) to generate a token. The token will be supplied to `fromTokenCredential`.
2222

23-
### Connect to IoT Hub
23+
To create required Microsoft Entra app parameters for `DefaultAzureCredential`, create a Microsoft Entra app registration that contains your selected authentication mechanism:
24+
25+
* Client secret
26+
* Certificate
27+
* Federated identity credential
28+
29+
For more information, see [Quickstart: Register an application with the Microsoft identity platform](/entra/identity-platform/quickstart-register-app).
30+
31+
Microsoft Entra apps may require permissions depending on operations performed. For example, [IoT Hub Twin Contributor](/azure/role-based-access-control/built-in-roles/internet-of-things#iot-hub-twin-contributor) is required to enable read and write access to a IoT Hub device and module twins. For more information, see [Azure built-in roles](/azure/role-based-access-control/built-in-roles#internet-of-things).
32+
33+
##### Connect to IoT Hub
2434

2535
Use [fromTokenCredential](/javascript/api/azure-iothub/registry?#azure-iothub-registry-fromtokencredential) to create a service connection to IoT Hub using an Entra token credential.
2636

includes/iot-hub-howto-connect-service-iothub-entra-python.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,25 @@ ms.manager: lizross
1111
ms.date: 11/06/2024
1212
---
1313

14-
For an overview of Python SDK authentication, see [Authenticate Python apps to Azure services by using the Azure SDK for Python](https://learn.microsoft.com/en-us/azure/developer/python/sdk/authentication/overview)
14+
For an overview of Python SDK authentication, see [Authenticate Python apps to Azure services by using the Azure SDK for Python](/azure/developer/python/sdk/authentication/overview)
1515

1616
### Entra token credential
1717

1818
You must generate and supply a token credential to `from_token_credential`.
1919

2020
[DefaultAzureCredential](/azure/developer/python/sdk/authentication/overview#use-defaultazurecredential-in-an-application) is the easiest way to generate a token. You can also use credential chains to generate a token. For more information, see [Credential chains in the Azure Identity client library for Python](/azure/developer/python/sdk/authentication/credential-chains).
2121

22-
### Connect to IoT Hub
22+
To create required Microsoft Entra app parameters for `DefaultAzureCredential`, create a Microsoft Entra app registration that contains your selected authentication mechanism:
23+
24+
* Client secret
25+
* Certificate
26+
* Federated identity credential
27+
28+
For more information, see [Quickstart: Register an application with the Microsoft identity platform](/entra/identity-platform/quickstart-register-app).
29+
30+
Microsoft Entra apps may require permissions depending on operations performed. For example, [IoT Hub Twin Contributor](/azure/role-based-access-control/built-in-roles/internet-of-things#iot-hub-twin-contributor) is required to enable read and write access to a IoT Hub device and module twins. For more information, see [Azure built-in roles](/azure/role-based-access-control/built-in-roles#internet-of-things).
31+
32+
#### Connect to IoT Hub
2333

2434
Use [from_token_credential](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-from-token-credential) to create a service connection to IoT Hub using an Entra token credential.
2535

@@ -28,7 +38,7 @@ Use [from_token_credential](/python/api/azure-iot-hub/azure.iot.hub.iothubregist
2838
* The Azure service URL
2939
* The Azure credential token
3040

31-
In this example, the Azure credential is obtained using `DefaultAzureCredential`. THe Azure domain URL and credential are then supplied to `BlobServiceClient`.
41+
In this example, the Azure credential is obtained using `DefaultAzureCredential`. The Azure domain URL and credential are then supplied to `BlobServiceClient`.
3242

3343
```python
3444
from azure.identity import DefaultAzureCredential

includes/iot-hub-howto-module-twins-node.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,13 @@ let Registry = require('azure-iothub').Registry;
325325
326326
### Connect to IoT hub
327327
328+
You can connect a backend service to IoT Hub using the following methods:
329+
330+
* Shared access policy
331+
* Microsoft Entra
332+
333+
#### Connect using a shared access policy
334+
328335
Use [fromConnectionString](/javascript/api/azure-iothub/registry?#azure-iothub-registry-fromconnectionstring) to connect to IoT hub.
329336
330337
The SDK methods in this section require these shared access policy permissions:
@@ -339,6 +346,10 @@ let connectionString = '{IoT hub shared access policy connection string}';
339346
let registry = Registry.fromConnectionString(serviceConnectionString);
340347
```
341348
349+
#### Connect using Microsoft Entra
350+
351+
[!INCLUDE [iot-hub-howto-connect-service-iothub-entra-node](iot-hub-howto-connect-service-iothub-entra-node.md)]
352+
342353
### Retrieve a module identity twin and update desired properties
343354
344355
You can create a patch that contains desired property updates for a module identity twin.

includes/iot-hub-howto-module-twins-python.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ from azure.iot.hub.models import Twin, TwinProperties, QuerySpecification, Query
164164

165165
### Connect to IoT hub
166166

167+
You can connect a backend service to IoT Hub using the following methods:
168+
169+
* Shared access policy
170+
* Microsoft Entra
171+
172+
#### Connect using a shared access policy
173+
167174
Connect to IoT hub using [from_connection_string](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-from-connection-string).
168175

169176
The SDK methods in this section require these shared access policy permissions:
@@ -181,6 +188,10 @@ IOTHUB_CONNECTION_STRING = "{IoT hub shared access policy connection string}"
181188
iothub_registry_manager = IoTHubRegistryManager.from_connection_string(IOTHUB_CONNECTION_STRING)
182189
```
183190

191+
#### Connect using Microsoft Entra
192+
193+
[!INCLUDE [iot-hub-howto-connect-service-iothub-entra-python](iot-hub-howto-connect-service-iothub-entra-python.md)]
194+
184195
### Retrieve and update module identity twin desired properties
185196

186197
You can update desired properties from a backend application using [update_module_twin](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-update-module-twin).

0 commit comments

Comments
 (0)