Azure / azure-iot-sdk-java

A Java SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-java/
Other
200 stars 237 forks source link

[Bug Report] Not compatible with newer version of Azure Identity SDK #1799

Closed michaeljgea closed 2 days ago

michaeljgea commented 6 days ago

Context

Description of the issue

Summary: IoT SDK is not compatible with newer version of Azure Identity SDK + using managed identity

Note: It works with azure-identity version 1.13.3, but fails with version 1.40.0

Steps to reproduce:

Code sample exhibiting the issue

// Run this within Azure and set environment variables AZURE_TENANT_ID and AZURE_CLIENT_ID accordingly
RegistryClient client = new RegistryClient(iotHubHostname, new DefaultAzureCredentialBuilder().build());
registryClient.getDevice("abc"); // fails 

Console log of the issue

com.microsoft.azure.sdk.iot.service.exceptions.IotHubUnauthorizedException: {"errorCode":401002,"message":"Unauthorized access","trackingId":"REDACTED","timestampUtc":"2024-11-08T09:05:03.062786036Z","info":null}
at com.microsoft.azure.sdk.iot.service.exceptions.IotHubExceptionManager.httpResponseVerification(IotHubExceptionManager.java:67)
timtay-microsoft commented 2 days ago

The IoT hub service client is no longer maintained in this repo. I'd suggest you file the issue over here instead: https://github.com/Azure/azure-iot-service-sdk-java/issues