Azure / Azure/azure-iot-service-sdk-java
[Bug Report] Not compatible with newer version of Azure Identity SDK
- Dominant language
- Java
- Stars
- 5
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
# Context
- Debian 12
- Java 17 (openjdk)
- SDK version: 2.1.9
## 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:
- Connect to IoT hub using managed identity
- Try any IoT hub request, e.g., registry request, direct method call, ...
## 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)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the managed-identity failure using RegistryClient, DefaultAzureCredentialBuilder, and azure-identity versions 1.13.3 and 1.40.0. Start with the failing request and the stack trace at IotHubExceptionManager.java:67, then compare authentication behavior between versions. Done means registry and other IoT Hub requests succeed with the newer SDK without a 401002 response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, java
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100