Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure SDK for python behind a corporate proxy #33607

Closed
ArturSyl opened this issue Dec 18, 2023 · 15 comments
Closed

Azure SDK for python behind a corporate proxy #33607

ArturSyl opened this issue Dec 18, 2023 · 15 comments
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@ArturSyl
Copy link

ArturSyl commented Dec 18, 2023

Type of issue

Code doesn't work

Description

Hello,

We are using a proxy and we intercept login.microsoftonline.com to verify which tenants users are going. However here when we intercept this request user get's error that ssl certificate is invalid. The proxy certificate is added to trusted root certificate so it works correctly for browser but not from Visual Studio. We tried whitelisting for ssl certificate bypass login.microsoftonline.com/tenantID but it fails, it only works when bypassing the whole login.microsoftonline.com which is not a good solution as we lose the tenants visibility in proxy.

Can you share how to use this code in VS behind a proxy ?

Cheers,
Arthur

Page URL

https://learn.microsoft.com/en-gb/python/api/azure-identity/azure.identity.clientsecretcredential?view=azure-python

Content source URL

https://github.com/MicrosoftDocs/azure-docs-sdk-python/blob/main/docs-ref-autogen/azure-identity/azure.identity.ClientSecretCredential.yml

Document Version Independent Id

03ee17be-6659-76b6-bcc1-44b2cb64b094

Article author

@lmazuel

Metadata

  • ID: 71fdf00e-23cc-b602-03c7-072d908d1f44
@github-actions github-actions bot added Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-triage This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 18, 2023
@xiangyan99
Copy link
Member

Thanks for reaching out.

Could you help give more details about:
"it works correctly for browser but not from Visual Studio"?

@xiangyan99 xiangyan99 added the needs-author-feedback More information is needed from author to address the issue. label Dec 18, 2023
@github-actions github-actions bot removed the needs-team-triage This issue needs the team to triage. label Dec 18, 2023
Copy link

Hi @ArturSyl. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Copy link

Hi @ArturSyl, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Dec 25, 2023
@ArturSyl
Copy link
Author

Hello,

Apology for delayed response.

Normally in company we test connection in browser and in application. Here the user in VS is trying to obtain secret password using your azure sdk for python script. However there can be a situation that our policy blocks the connection due to specifing rule in place. This is why if possible we test also in browser and verify the logs. In browser we don't use azure sdk we just go to vault and check if connection is proper and we can verify the connectivity to the website.

However when using azure sdk for python user issues a connect request to login.microsoftonline.com which we ssl intercept on proxy and here it fails. This is probably request for azure environment. We use login.microsoftonline.com for proxy authentication and all O365 apps and it works correctly but here there is something maybe in the method of the request that it fails. In logs we only see the connection through VS is there, it's allowed but size in bytes is different.

The problem is we don't know why your azure sdk fails with login.microsoftonline.com through proxy. Is there a method to bypass the proxy, point to proxy (so we are sure that whole traffic always hits proxy), is there a token generated through your request that proxy strips, is your code validating if there is men in middle attack (proxy is a main in the middle device) and blocks the sending of some token etc.

In short.... how we can we approach your script when user is behind corporate proxy.

Thank you and happy holidays.

@github-actions github-actions bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. labels Dec 27, 2023
@xiangyan99
Copy link
Member

Happy new year!

Thanks for sharing the information.

You can specify the proxy information when creating the credential object.

e.g.:

cred = ClientSecretCredential(proxies={'http': 'http://10.10.1.10:3148'})

please let us know if it does not work.

@xiangyan99 xiangyan99 added the needs-author-feedback More information is needed from author to address the issue. label Jan 2, 2024
Copy link

github-actions bot commented Jan 2, 2024

Hi @ArturSyl. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@github-actions github-actions bot removed the needs-team-attention This issue needs attention from Azure service team or SDK team label Jan 2, 2024
@ArturSyl
Copy link
Author

ArturSyl commented Jan 2, 2024 via email

@github-actions github-actions bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Jan 2, 2024
@xiangyan99
Copy link
Member

Adding @rayluo for more insights.

@rayluo
Copy link
Member

rayluo commented Jan 3, 2024

I don't really have a specific suggestion here.

  1. On the one hand, Azure SDK's underlying auth library - MSAL - supports a proxies parameter. You can probably try it by this one-liner (currently containing incomplete proxies setting which you will need to adjust):

    python -c "import msal; print(msal.ConfidentialClientApplication('your_client_id', client_credential='your_secret', proxies=...).acquire_token_for_client(['your_scope']))"

    You can try this to see whether it works in your proxy environment.

  2. On the other hand, that parameter in MSAL only works when using the default http client which is based on requests. But, AFAIK, Azure SDK uses its own http client, so, the test above may not mean anything in terms of the Azure SDK's behavior.

@xiangyan99
Copy link
Member

@ArturSyl

Could you help to try the code Ray provided:

python -c "import msal; print(msal.ConfidentialClientApplication('your_client_id', client_credential='your_secret').acquire_token_for_client(['your_scope']))"

and let us know if it works?

@xiangyan99 xiangyan99 added the needs-author-feedback More information is needed from author to address the issue. label Jan 4, 2024
@github-actions github-actions bot removed the needs-team-attention This issue needs attention from Azure service team or SDK team label Jan 4, 2024
Copy link

github-actions bot commented Jan 4, 2024

Hi @ArturSyl. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@ArturSyl
Copy link
Author

ArturSyl commented Jan 4, 2024 via email

@github-actions github-actions bot added the needs-team-attention This issue needs attention from Azure service team or SDK team label Jan 4, 2024
@github-actions github-actions bot removed the needs-author-feedback More information is needed from author to address the issue. label Jan 4, 2024
@xiangyan99 xiangyan99 added the needs-author-feedback More information is needed from author to address the issue. label Jan 11, 2024
@github-actions github-actions bot removed the needs-team-attention This issue needs attention from Azure service team or SDK team label Jan 11, 2024
Copy link

Hi @ArturSyl. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Copy link

Hi @ArturSyl, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Jan 18, 2024
@ArturSyl
Copy link
Author

ArturSyl commented Jan 22, 2024 via email

@github-actions github-actions bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. labels Jan 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Development

No branches or pull requests

3 participants