I can run the code locally and it works, but adding it to a Django view causes it to get a ReadTimeout.
e | ReadTimeoutError("HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Read timed out. (read timeout=None)",)
Hi @tinyweasel I am trying to better understand what issue you are facing - what code do you run and which azure packages do you use?
Trying to use azure.common.credentials and azure.loganalytics to query LogAnalytics, but the call to the token endpoint gets this ReadTimeout if I try to do this in a Django view. It works as a simple Python script though.
I've figured out that this is a problem with the requests library as I get the same error using that library directly.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @OlegAnaniev-MSFT , @yossi-y , @sameergMS
@kaerm this doesn't seem specific to Log Analytics? Seem the HTTP calls are not getting past the initial token acquisition calls to login.microsoft.com.
It's not clear to me @tinyweasel if you are using the SDK or trying to implement the same logic elsewhere using vanilla requests in a django setup, but it sounds like there may be some issue with how you are crafting the authentication requests. I'd suggest using fiddler or similar and capturing the calls to debug further, if you haven't already. Given you mention the functionality works standalone, I'd have to guess the issue is somewhere in the integration/request building.
I was trying to make a django view which uses the following parts of the SDK.
credentials = ServicePrincipalCredentials(
client_id=CLIENT,
secret=KEY,
tenant=TENANT_ID,
resource='https://api.loganalytics.io'
)
client = LogAnalyticsDataClient(credentials, base_url=None)`
Eventually ended up running as a standalone script and saving to db and then accessing the db with Django.
Looking at your original comment, the error was:
ReadTimeoutError("HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Read timed out. (read timeout=None)",)
Seems like an issue with AAD login. I wonder if this correlated to some outage...if you were hitting failures directly from api.loganalytics.io, I might be able to point you to some more helpful folks, but that code snippet looks fine to me and from the error I can see you're not reaching the backend service at all. If that issue persists I'd have to defer to @kaerm or someone from the SDK team as it seems like there's some issue in the common auth implementation, otherwise I'd assume it was transient.
If that's the second case: @mayurid could you take a look at this?
@lmazuel - Can we get this one addressed soon? It is currently 250 days old. Thanks, Jon
@tinyweasel - I'm going to resolve this as transient, please re-open if you continue to see the issue. Thanks
Close away, I ended up not calling it directly with Django so I'll have no update on this.