Skip to content

Commit 533939d

Browse files
committed
add a new article
1 parent 1aede5e commit 533939d

4 files changed

Lines changed: 84 additions & 3 deletions

File tree

support/entra/entra-id/app-integration/capture-https-traffic-http-fiddler-entra-id-app.md renamed to support/entra/entra-id/app-integration/capture-https-traffic-fiddler-entra-id-app.md

File renamed without changes.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Collect HTTPS Traffic using Fiddler from Python app with Microsoft Entra ID
3+
description: Provide instructions on how to collect HTTPS traffic using Fiddler from Microsoft Entra ID Apps
4+
ms.date: 03/20/2025
5+
ms.author: bachoang
6+
ms.service: entra-id
7+
ms.custom: sap:Enterprise Applications
8+
---
9+
# Collect HTTPS traffic using Fiddler from Python Apps
10+
11+
Capturing encrypted HTTPS web traffic in Python with Fiddler can be challenging because Python use its own trusted certificate store rather than the operating system’s certificate store. Additionally, Python does not use a proxy by default in certain scenario. This article explains how to capture SSL traffic using Fiddler for Python app across different scenarios.
12+
13+
## ADAL for Python
14+
15+
When you use Fiddler to capture HTTPs traffic in an Python app that integrates Azure Active Directory Authentication Library (ADAL), you may receive SSL errors. This is caused by Python does not trust the Fiddler certificate. Here are two methods to resolve this issue:
16+
17+
> [!Note]
18+
> Disabling SSL verification poses a security risk. It should only be used for troubleshooting purposes and avoided in production environments.
19+
20+
- Set an environment variable at the beginning of your Python app before initializing the AuthenticationContext object:
21+
22+
```python
23+
import os
24+
...
25+
os.environ["ADAL_PYTHON_SSL_NO_VERIFY"] = "1"
26+
```
27+
- Pass the `verify_ssl=False` flag to the AuthenticationContext method:
28+
```python
29+
context = adal.AuthenticationContext(authority, verify_ssl=False)
30+
```
31+
32+
## MSAL for Python
33+
When you use the Microsoft Authentication Library (MSAL) for Python, you can disable SSL verification as follows:
34+
35+
```python
36+
app = msal.PublicClientApplication( client_id=appId, authority="https://login.microsoftonline.com/" + tenantId, verify=False )
37+
```
38+
## Python Requests Module
39+
40+
The Requests module does not use Proxy by default, you must force the request to go through the Fiddler proxy. Below is an example showing how to do this:
41+
42+
```python
43+
import requests
44+
45+
46+
access_token = token.get('accessToken')
47+
48+
endpoint = ‘headers = {“Authorization”: ‘Bearer ‘ + access_token}
49+
50+
json_output = requests.get(
51+
endpoint,
52+
headers=headers,
53+
proxies={"http": "http://127.0.0.1:8888", "https": "http://127.0.0.1:8888"},
54+
verify=False
55+
).json()
56+
```
57+
## AAD Libraries for Python or GraphRbacManagementClient
58+
59+
```python
60+
from azure.graphrbac import GraphRbacManagementClient
61+
from azure.common.credentials import UserPassCredentials
62+
63+
credentials = UserPassCredentials(
64+
<username>, # Your user name
65+
<password>, # Your password
66+
resource=”https://graph.windows.net”,
67+
verify=False
68+
)
69+
tenant_id = <tenant name or tenant id>
70+
graphrbac_client = GraphRbacManagementClient(credentials, tenant_id)
71+
graphrbac_client.config.connection.verify=False
72+
res = graphrbac_client.users.get(<UPN or ObjectID>)
73+
print(res.display_name)
74+
```
75+
76+
[!INCLUDE [Third-party disclaimer](../../../includes/third-party-disclaimer.md)]
77+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]

support/entra/entra-id/app-integration/capture-https-traffic-http-fiddler-python-app - Copy.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Capturing encrypted HTTPS web traffic in Python with Fiddler can be challenging
1515
When you use Fiddler to capture HTTPs traffic in an Python app that integrates Azure Active Directory Authentication Library (ADAL), you may receive SSL errors. This is caused by Python does not trust the Fiddler certificate. Here are two methods to resolve this issue:
1616

1717
> [!Note]
18-
> Disabling SSL verification poses a security risk. It should only be used for troubleshooting purposes and avoided in production environments.
18+
> Disabling SSL verification is a security risk. It should only be used for troubleshooting purposes and avoided in production environments.
1919
2020
- Set an environment variable at the beginning of your Python app before initializing the AuthenticationContext object:
2121

@@ -56,6 +56,8 @@ json_output = requests.get(
5656
```
5757
## AAD Libraries for Python or GraphRbacManagementClient
5858

59+
To disable SSL verification, refer to the following sample:
60+
5961
```python
6062
from azure.graphrbac import GraphRbacManagementClient
6163
from azure.common.credentials import UserPassCredentials

support/entra/entra-id/toc.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,5 +410,7 @@
410410

411411
- name: Capture SSL traffic
412412
items:
413-
- name: Capture HTTPS traffic with Http Fiddler
414-
href: app-integration/capture-https-traffic-http-fiddler-entra-id-app.md
413+
- name: Capture HTTPS traffic with Fiddler
414+
href: app-integration/capture-https-traffic-http-fiddler-entra-id-app.md
415+
- name: Capture Python HTTPs traffic with Fiddler
416+
href: capture-https-traffic-fiddler-entra-id-app.md

0 commit comments

Comments
 (0)