Open MiguelElGallo opened 3 weeks ago
Update:
If I remove
"ehconnection__credential": "managedIdentity", "ehconnection__clientId": "<clientId>"
Then I will get the following error when running locally, but then it will retry automatically , and it will work.
It seems some processes are faster than others.
[2024-09-03T11:38:31.361Z] False MSAL 4.60.3.0 MSAL.CoreCLR .NET 6.0.31 MacOS [2024-09-03 11:38:31Z - b794dc2f-386f-49ff-a11e-fa4388920033] Exception type: Azure.Identity.CredentialUnavailableException
[2024-09-03T11:38:31.361Z] ---> Inner Exception Details
[2024-09-03T11:38:31.361Z] Exception type: Azure.RequestFailedException
[2024-09-03T11:38:31.361Z] Date:Tue, 03 Sep 2024 11:38:31 GMT
[2024-09-03T11:38:31.361Z] ---> Inner Exception Details
[2024-09-03T11:38:31.361Z] Connection:keep-alive
[2024-09-03T11:38:31.362Z] Exception type: System.Net.Http.HttpRequestException
[2024-09-03T11:38:31.362Z] Keep-Alive:REDACTED
[2024-09-03T11:38:31.362Z]
[2024-09-03T11:38:31.362Z] ---> Inner Exception Details
[2024-09-03T11:38:31.362Z] Exception type: System.Net.Sockets.SocketException
[2024-09-03T11:38:31.362Z] To see full exception details, enable PII Logging. See https://aka.ms/msal-net-logging
[2024-09-03T11:38:31.362Z] at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.CreateException(SocketError error, Boolean forAsyncThrow)
[2024-09-03T11:38:31.362Z] at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ConnectAsync(Socket socket)
[2024-09-03T11:38:31.362Z] at System.Net.Sockets.Socket.ConnectAsync(EndPoint remoteEP, CancellationToken cancellationToken)
[2024-09-03T11:38:31.362Z] at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
[2024-09-03T11:38:31.362Z] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
[2024-09-03T11:38:31.362Z] at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
[2024-09-03T11:38:31.362Z] at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-09-03T11:38:31.362Z] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
[2024-09-03T11:38:31.362Z] at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-09-03T11:38:31.362Z] at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-09-03T11:38:31.362Z] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
[2024-09-03T11:38:31.363Z] at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-09-03T11:38:31.363Z] at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
[2024-09-03T11:38:31.363Z] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
[2024-09-03T11:38:31.363Z] at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
[2024-09-03T11:38:31.363Z] at System.Net.Http.HttpConnectionPool.<>c__DisplayClass75_0.<CheckForHttp11ConnectionInjection>b__0()
[2024-09-03T11:38:31.363Z] at System.Threading.Tasks.Task`1.InnerInvoke()
[2024-09-03T11:38:31.363Z] at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
Expected Behavior
If you want to use managed identity for a function to have a trigger binding for event hub you can do:
Python
local.settings.json (for running local)
This does not work
Actual Behavior
It tries to connect to 169.254.169.254 which is a know address for Azure VMs. But it seems the Azure Function (local) runtime doest no provide that. (see log below)
Most probably in the Azure runtime it will work, but locally it does not work.
Note: In "ehconnection__clientId": "" I have set my user id. I obtained it via :
az ad signed-in-user show
and field id from there.Steps to Reproduce
1 Write an azure function that has Azure EventHub inbound binding 2 configure it to use managed identity 3 try to run it locally
Relevant code being tried
No response
Relevant log output
No response
requirements.txt file
No response
Where are you facing this problem?
Local - Core Tools
Additional Information
No response