Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azure-iot-hub vs azure-iot-sdk and identity. #15

Open
alemag1986 opened this issue Jun 5, 2024 · 1 comment
Open

azure-iot-hub vs azure-iot-sdk and identity. #15

alemag1986 opened this issue Jun 5, 2024 · 1 comment

Comments

@alemag1986
Copy link

Hi team,

First question, since we rely on IotHub for our daily ops and we are building services and processes around it, we would like to know if this library azure-iot-hub is the way to go or it has been deprecated, since it looks stale and we should favor azure-iot-sdk?

Second to that, we are trying to get rid of all connection string as much as possible. Our middleware, runs on Azure and the webapp has all the needed permissions to operate the IoTHub, create new devices, change device twin definition, check the state of devices and send direct methods. With that in mind, we haven't been able to integrate azure-identity. Does the library support Identity using something like DefaultAzureCredential from the azure-identity package? If identity is a possibility, do you mind sharing an example?

Kind regards,
Alejandro

@AndreRicardo-Zoetis
Copy link

AndreRicardo-Zoetis commented Dec 12, 2024

They are two different libraries for different purposes.

azure-iot-hub-python is the service API to connect for example your API in Python to Azure to send cloud to device messages.
https://learn.microsoft.com/en-us/azure/iot/iot-sdks#iot-hub-service-sdks

azure-iot-sdk-python is the device API to connect your device running Python to for example read messages sent from the cloud.
https://learn.microsoft.com/en-us/azure/iot/iot-sdks#device-sdks

Second question, yes you can use from azure.identity import DefaultAzureCredential, I have not tested it yet but has a sample for it.

Sample:

  1. Create credential

    # https://pypi.org/project/azure-identity/ for more information on
    # authenticating with DefaultAzureCredential or other implementations of TokenCredential.
    credential = DefaultAzureCredential()

  2. Use from_token_credential

    # Create IoTHubRegistryManager
    iothub_registry_manager = IoTHubRegistryManager.from_token_credential(url, credential)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants