Skip to content

Commit cdd6d73

Browse files
authored
Revise and expand troubleshooting guide
Updated troubleshooting guide with detailed sections on common issues related to Python environment, Azure authentication, Cosmos DB, data pipeline, Terraform, and general tips. Enhanced formatting and added new troubleshooting steps.
1 parent 80fd6e5 commit cdd6d73

1 file changed

Lines changed: 55 additions & 59 deletions

File tree

TROUBLESHOOTING.md

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,33 @@ Last updated: 2025-11-24
1111

1212
> This guide covers common issues you may encounter when deploying and running this Azure AI Shopping demo application.
1313
14-
## Table of Contents
15-
- [Python Environment Issues](#python-environment-issues)
16-
- [Azure Authentication Issues](#azure-authentication-issues)
17-
- [Cosmos DB Issues](#cosmos-db-issues)
18-
- [Data Pipeline Issues](#data-pipeline-issues)
19-
- [Terraform Issues](#terraform-issues)
14+
<details>
15+
<summary><b>Table of Content</b> (Click to expand)</summary>
16+
17+
- [Python Not Found](#python-not-found)
18+
- [Virtual Environment Creation Failed](#virtual-environment-creation-failed)
19+
- [Package Installation Failed](#package-installation-failed)
20+
- [Not Logged into Azure CLI](#not-logged-into-azure-cli)
21+
- [AAD Authentication Failed](#aad-authentication-failed)
22+
- [Local Authorization Disabled Error](#local-authorization-disabled-error)
23+
- [Connection Timeout](#connection-timeout)
24+
- [CSV File Not Found](#csv-file-not-found)
25+
- [CSV Parsing Error](#csv-parsing-error)
26+
- [Environment File Missing](#environment-file-missing)
27+
- [Failed to Authenticate to Cosmos DB](#failed-to-authenticate-to-cosmos-db)
28+
- [Resource Already Exists](#resource-already-exists)
29+
- [Insufficient Permissions](#insufficient-permissions)
30+
- [Provider Configuration Error](#provider-configuration-error)
31+
- [State Lock Error](#state-lock-error)
32+
- [Enable Verbose Logging](#enable-verbose-logging)
33+
- [Check Azure Service Health](#check-azure-service-health)
34+
- [Clean Up and Retry](#clean-up-and-retry)
35+
- [Still Having Issues?](#still-having-issues)
36+
37+
</details>
38+
39+
## Python Not Found
2040

21-
---
22-
23-
## Python Environment Issues
24-
25-
### Python Not Found
2641
```
2742
ERROR: Python is not installed or not in PATH
2843
```
@@ -32,7 +47,7 @@ ERROR: Python is not installed or not in PATH
3247
- Ensure Python is added to your system PATH during installation
3348
- Verify installation: `python --version`
3449

35-
### Virtual Environment Creation Failed
50+
## Virtual Environment Creation Failed
3651
```
3752
ERROR: Failed to create virtual environment
3853
```
@@ -43,7 +58,7 @@ ERROR: Failed to create virtual environment
4358
- Check if `python -m venv` works manually: `python -m venv test_venv`
4459
- On Windows, ensure your execution policy allows script execution
4560

46-
### Package Installation Failed
61+
## Package Installation Failed
4762
```
4863
ERROR: Could not install packages due to an OSError
4964
```
@@ -54,11 +69,8 @@ ERROR: Could not install packages due to an OSError
5469
- Try installing with `--no-cache-dir`: `pip install --no-cache-dir -r requirements.txt`
5570
- For Windows + pandas issues, use pre-built wheels by ensuring `pandas>=2.2.2` in requirements.txt
5671

57-
---
5872

59-
## Azure Authentication Issues
60-
61-
### Not Logged into Azure CLI
73+
## Not Logged into Azure CLI
6274
```
6375
ERROR: Please run 'az login' to setup account
6476
```
@@ -75,7 +87,7 @@ az account show
7587
az account set --subscription <subscription-id>
7688
```
7789

78-
### AAD Authentication Failed
90+
## AAD Authentication Failed
7991
```
8092
DefaultAzureCredential failed to retrieve a token
8193
```
@@ -86,20 +98,17 @@ DefaultAzureCredential failed to retrieve a token
8698
3. Verify the resource exists and you have access
8799
4. Try clearing Azure credentials cache: `az account clear` then `az login` again
88100

89-
---
90-
91-
## Cosmos DB Issues
92101

93-
### Local Authorization Disabled Error
102+
## Local Authorization Disabled Error
94103
```
95104
ERROR: Local Authorization is disabled. Use an AAD token to authorize all requests.
96105
```
97106

98-
This error occurs when Cosmos DB requires Azure Active Directory (AAD) authentication instead of key-based authentication.
107+
> This error occurs when Cosmos DB requires Azure Active Directory (AAD) authentication instead of key-based authentication.
99108
100109
**Common Causes and Solutions**:
101110

102-
#### 1. Not logged into Azure CLI
111+
- Not logged into Azure CLI
103112

104113
```powershell
105114
# Login to Azure CLI
@@ -112,11 +121,11 @@ az account show
112121
az account set --subscription <subscription-id>
113122
```
114123

115-
After logging in, try running the script again.
124+
> After logging in, try running the script again.
116125
117-
#### 2. Public Network Access Disabled
126+
- Public Network Access Disabled
118127

119-
If your Cosmos DB has public network access disabled, your local machine or Codespace VM cannot connect.
128+
> If your Cosmos DB has public network access disabled, your local machine or Codespace VM cannot connect.
120129
121130
**Solution via Azure Portal**:
122131
- Navigate to your Cosmos DB account in the Azure portal
@@ -134,9 +143,7 @@ az cosmosdb update \
134143
--enable-public-network true
135144
```
136145

137-
#### 3. Insufficient Permissions
138-
139-
Your Azure account needs appropriate role assignments on the Cosmos DB account.
146+
- Insufficient Permissions: Your Azure account needs appropriate role assignments on the Cosmos DB account.
140147

141148
**Required roles**:
142149
- `Cosmos DB Built-in Data Contributor` (for read/write access)
@@ -156,7 +163,7 @@ az cosmosdb sql role assignment create \
156163
--scope "/"
157164
```
158165

159-
### Connection Timeout
166+
## Connection Timeout
160167
```
161168
ERROR: Request timeout
162169
```
@@ -167,11 +174,8 @@ ERROR: Request timeout
167174
- Ensure public network access is enabled (see above)
168175
- Check if Azure services are experiencing outages: https://status.azure.com/
169176

170-
---
171-
172-
## Data Pipeline Issues
173177

174-
### CSV File Not Found
178+
## CSV File Not Found
175179
```
176180
WARNING: CSV data file not found at data/updated_product_catalog(in).csv
177181
```
@@ -183,7 +187,7 @@ Download or place the product catalog CSV file in the `src/data/` directory:
183187
curl -o src/data/updated_product_catalog(in).csv https://raw.githubusercontent.com/microsoft/TechWorkshop-L300-AI-Apps-and-agents/main/src/data/updated_product_catalog(in).csv
184188
```
185189

186-
### CSV Parsing Error
190+
## CSV Parsing Error
187191
```
188192
ERROR: Error tokenizing data. C error: Expected X fields, saw Y
189193
```
@@ -194,7 +198,7 @@ ERROR: Error tokenizing data. C error: Expected X fields, saw Y
194198
- Verify the CSV has the correct number of columns (6): ProductID, ProductName, ProductCategory, ProductDescription, Price, ImageUrl
195199
- Try opening the CSV in a text editor to check for formatting issues
196200

197-
### Environment File Missing
201+
## Environment File Missing
198202
```
199203
ERROR: .env file not found
200204
```
@@ -206,7 +210,7 @@ cd terraform-infrastructure
206210
terraform apply -auto-approve
207211
```
208212

209-
### Failed to Authenticate to Cosmos DB
213+
## Failed to Authenticate to Cosmos DB
210214
```
211215
ERROR: Failed to authenticate to Cosmos DB using DefaultAzureCredential and no valid COSMOS_DB_KEY was provided
212216
```
@@ -217,11 +221,7 @@ ERROR: Failed to authenticate to Cosmos DB using DefaultAzureCredential and no v
217221
- Check that `COSMOS_DB_ENDPOINT` and `COSMOS_DB_KEY` are set correctly in `.env`
218222
- The script will automatically try AAD authentication first, then fall back to key-based auth
219223

220-
---
221-
222-
## Terraform Issues
223-
224-
### Resource Already Exists
224+
## Resource Already Exists
225225
```
226226
ERROR: A resource with the ID already exists
227227
```
@@ -231,7 +231,8 @@ ERROR: A resource with the ID already exists
231231
- Or destroy and recreate: `terraform destroy` then `terraform apply`
232232
- Check for resources in other resource groups with the same name
233233

234-
### Insufficient Permissions
234+
## Insufficient Permissions
235+
235236
```
236237
ERROR: The client does not have authorization to perform action
237238
```
@@ -241,7 +242,8 @@ ERROR: The client does not have authorization to perform action
241242
- Check if specific Azure policies are blocking resource creation
242243
- Contact your Azure administrator to grant necessary permissions
243244

244-
### Provider Configuration Error
245+
## Provider Configuration Error
246+
245247
```
246248
ERROR: Error configuring the backend "azurerm"
247249
```
@@ -251,7 +253,8 @@ ERROR: Error configuring the backend "azurerm"
251253
- Check that the specified subscription exists and you have access
252254
- Ensure the backend storage account and container exist (if using remote state)
253255

254-
### State Lock Error
256+
## State Lock Error
257+
255258
```
256259
ERROR: Error acquiring the state lock
257260
```
@@ -262,13 +265,9 @@ ERROR: Error acquiring the state lock
262265
terraform force-unlock <lock-id>
263266
```
264267

265-
Only force-unlock if you're certain no other Terraform process is running.
268+
> Only force-unlock if you're certain no other Terraform process is running.
266269
267-
---
268-
269-
## General Tips
270-
271-
### Enable Verbose Logging
270+
## Enable Verbose Logging
272271

273272
For more detailed error information:
274273

@@ -290,12 +289,11 @@ export TF_LOG=DEBUG
290289
terraform apply
291290
```
292291

293-
### Check Azure Service Health
292+
## Check Azure Service Health
294293

295-
If experiencing unexpected issues, check Azure service status:
296-
- https://status.azure.com/
294+
> If experiencing unexpected issues, check [Azure service status](https://status.azure.com/)
297295
298-
### Clean Up and Retry
296+
## Clean Up and Retry
299297

300298
> Sometimes a clean slate helps:
301299
@@ -311,8 +309,6 @@ terraform init
311309
terraform apply
312310
```
313311

314-
---
315-
316312
## Still Having Issues?
317313

318314
> If you continue experiencing problems:
@@ -328,4 +324,4 @@ terraform apply
328324
<img src="https://img.shields.io/badge/Total%20views-1386-limegreen" alt="Total views">
329325
<p>Refresh Date: 2025-11-12</p>
330326
</div>
331-
<!-- END BADGE -->
327+
<!-- END BADGE -->

0 commit comments

Comments
 (0)