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)
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
Console log of the issue