azure-sdk-for-python: azure-identity: Connection reset with InteractiveBrowserCredential in container with port binding for redirect URI

  • Package Name: azure-identity
  • Package Version: 1.14.0
  • Operating System: macOS using Docker
  • Python Version: 3.10

Describe the bug Inside a container, I’m using InteractiveBrowserCredential with an App with http://localhost:8000 as a valid callback URI. Forcing that URI in the InteractiveBrowserCredential to be that callback URI and binding the port 8000 on the host to the 8000 on the container, azure-identity detects that no browser is present in the container and gives me a link to call from the host machine. When I make that request from the host, I get no answer from the lib. If I make the request inside the container (using curl for instance), the authentication succeeds.

To Reproduce Run this in a container with docker run --rm -it -p 8000:8000 python:3.10-slim bash

from azure.identity import InteractiveBrowserCredential

credential = InteractiveBrowserCredential(
        tenant_id=<REDACTED>,
        client_id=<REDACTED>,
        redirect_uri="http://localhost:8000",
    )
record = credential.authenticate(scopes=[<REDACTED>])

In Safari, I get “the server unexpectedly dropped the connection”.

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Just wanted to add more information on this: I changed from the azure-identity package to the msal package, I was getting an error saying that no browser was found using azure-identity. Something changed meanwhile and since this package uses msal, I think it’s better to use it directly.