Skip to content

Commit 07cc7f9

Browse files
Fix Markdown syntax issues
1 parent 680b1d1 commit 07cc7f9

2 files changed

Lines changed: 44 additions & 11 deletions

File tree

TROUBLESHOOTING.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,45 @@ ERROR: Python is not installed or not in PATH
4343
```
4444

4545
**Solution**:
46-
- Install Python 3.8+ from https://www.python.org/downloads/
46+
47+
- Install Python 3.8+ from <https://www.python.org/downloads/>
4748
- Ensure Python is added to your system PATH during installation
4849
- Verify installation: `python --version`
4950

5051
## Virtual Environment Creation Failed
52+
5153
```
5254
ERROR: Failed to create virtual environment
5355
```
5456

5557
**Solution**:
58+
5659
- Ensure you have write permissions to the `src` directory
5760
- Try deleting existing `venv` folder: `Remove-Item -Recurse -Force venv`
5861
- Check if `python -m venv` works manually: `python -m venv test_venv`
5962
- On Windows, ensure your execution policy allows script execution
6063

6164
## Package Installation Failed
65+
6266
```
6367
ERROR: Could not install packages due to an OSError
6468
```
6569

6670
**Solution**:
71+
6772
- Update pip: `python -m pip install --upgrade pip`
6873
- Clear pip cache: `pip cache purge`
6974
- Try installing with `--no-cache-dir`: `pip install --no-cache-dir -r requirements.txt`
7075
- For Windows + pandas issues, use pre-built wheels by ensuring `pandas>=2.2.2` in requirements.txt
7176

72-
7377
## Not Logged into Azure CLI
78+
7479
```
7580
ERROR: Please run 'az login' to setup account
7681
```
7782

7883
**Solution**:
84+
7985
```powershell
8086
# Login to Azure CLI
8187
az login
@@ -88,18 +94,20 @@ az account set --subscription <subscription-id>
8894
```
8995

9096
## AAD Authentication Failed
97+
9198
```
9299
DefaultAzureCredential failed to retrieve a token
93100
```
94101

95102
**Solution**:
103+
96104
1. Ensure you're logged into Azure CLI: `az login`
97105
2. Check your account has proper permissions
98106
3. Verify the resource exists and you have access
99107
4. Try clearing Azure credentials cache: `az account clear` then `az login` again
100108

101-
102109
## Local Authorization Disabled Error
110+
103111
```
104112
ERROR: Local Authorization is disabled. Use an AAD token to authorize all requests.
105113
```
@@ -128,6 +136,7 @@ az account set --subscription <subscription-id>
128136
> If your Cosmos DB has public network access disabled, your local machine or Codespace VM cannot connect.
129137
130138
**Solution via Azure Portal**:
139+
131140
- Navigate to your Cosmos DB account in the Azure portal
132141
- Select **Networking** from the Settings menu
133142
- Ensure **Public network access** is set to **All networks**
@@ -136,6 +145,7 @@ az account set --subscription <subscription-id>
136145
- Try running the script again
137146

138147
**Solution via Azure CLI**:
148+
139149
```powershell
140150
az cosmosdb update \
141151
--name <cosmos-account-name> \
@@ -146,10 +156,12 @@ az cosmosdb update \
146156
- Insufficient Permissions: Your Azure account needs appropriate role assignments on the Cosmos DB account.
147157

148158
**Required roles**:
159+
149160
- `Cosmos DB Built-in Data Contributor` (for read/write access)
150161
- Or `Contributor` at the resource group level
151162

152163
**Solution via Azure CLI**:
164+
153165
```powershell
154166
# Get your user object ID
155167
$userId = (az ad signed-in-user show --query id -o tsv)
@@ -164,18 +176,20 @@ az cosmosdb sql role assignment create \
164176
```
165177

166178
## Connection Timeout
179+
167180
```
168181
ERROR: Request timeout
169182
```
170183

171184
**Solution**:
185+
172186
- Check your network connection
173187
- Verify Cosmos DB firewall settings allow your IP address
174188
- Ensure public network access is enabled (see above)
175-
- Check if Azure services are experiencing outages: https://status.azure.com/
176-
189+
- Check if Azure services are experiencing outages: <https://status.azure.com/>
177190

178191
## CSV File Not Found
192+
179193
```
180194
WARNING: CSV data file not found at data/updated_product_catalog(in).csv
181195
```
@@ -188,45 +202,53 @@ curl -o src/data/updated_product_catalog(in).csv https://raw.githubusercontent.c
188202
```
189203

190204
## CSV Parsing Error
205+
191206
```
192207
ERROR: Error tokenizing data. C error: Expected X fields, saw Y
193208
```
194209

195210
**Solution**:
211+
196212
- Ensure CSV fields with commas are properly quoted
197213
- Check for special characters or encoding issues
198214
- Verify the CSV has the correct number of columns (6): ProductID, ProductName, ProductCategory, ProductDescription, Price, ImageUrl
199215
- Try opening the CSV in a text editor to check for formatting issues
200216

201217
## Environment File Missing
218+
202219
```
203220
ERROR: .env file not found
204221
```
205222

206223
**Solution**:
224+
207225
```bash
208226
# Run Terraform to generate the .env file
209227
cd terraform-infrastructure
210228
terraform apply -auto-approve
211229
```
212230

213231
## Failed to Authenticate to Cosmos DB
232+
214233
```
215234
ERROR: Failed to authenticate to Cosmos DB using DefaultAzureCredential and no valid COSMOS_DB_KEY was provided
216235
```
217236

218237
**Solution**:
238+
219239
- Ensure your `.env` file is properly generated with correct keys
220240
- Run `terraform apply` again if needed
221241
- Check that `COSMOS_DB_ENDPOINT` and `COSMOS_DB_KEY` are set correctly in `.env`
222242
- The script will automatically try AAD authentication first, then fall back to key-based auth
223243

224244
## Resource Already Exists
245+
225246
```
226247
ERROR: A resource with the ID already exists
227248
```
228249

229250
**Solution**:
251+
230252
- Import the existing resource: `terraform import <resource_type>.<name> <azure_resource_id>`
231253
- Or destroy and recreate: `terraform destroy` then `terraform apply`
232254
- Check for resources in other resource groups with the same name
@@ -238,6 +260,7 @@ ERROR: The client does not have authorization to perform action
238260
```
239261

240262
**Solution**:
263+
241264
- Ensure your Azure account has `Contributor` or `Owner` role on the subscription or resource group
242265
- Check if specific Azure policies are blocking resource creation
243266
- Contact your Azure administrator to grant necessary permissions
@@ -249,6 +272,7 @@ ERROR: Error configuring the backend "azurerm"
249272
```
250273

251274
**Solution**:
275+
252276
- Verify your Azure credentials are configured: `az login`
253277
- Check that the specified subscription exists and you have access
254278
- Ensure the backend storage account and container exist (if using remote state)
@@ -260,6 +284,7 @@ ERROR: Error acquiring the state lock
260284
```
261285

262286
**Solution**:
287+
263288
```bash
264289
# Force unlock (use with caution)
265290
terraform force-unlock <lock-id>
@@ -272,18 +297,21 @@ terraform force-unlock <lock-id>
272297
For more detailed error information:
273298

274299
**Azure CLI**:
300+
275301
```powershell
276302
az <command> --debug
277303
```
278304

279305
**Python Scripts**:
280306
Set environment variable before running:
307+
281308
```powershell
282309
$env:AZURE_LOG_LEVEL = "DEBUG"
283310
python pipelines/script.py
284311
```
285312

286313
**Terraform**:
314+
287315
```bash
288316
export TF_LOG=DEBUG
289317
terraform apply

src/DATA_PIPELINE.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Last updated: 2025-11-24
1111

1212
> This automation handles the complete data pipeline setup for the Azure AI Shopping application.
1313
14-
1514
<details>
1615
<summary><b>Table of Content</b> (Click to expand)</summary>
1716

@@ -29,15 +28,14 @@ Last updated: 2025-11-24
2928

3029
</details>
3130

32-
3331
> [!NOTE]
3432
> What It Does? The data pipeline automation performs the following tasks:
33+
>
3534
> 1. **Creates Python Virtual Environment**: Sets up an isolated Python environment with all required dependencies
3635
> 2. **Imports Data to Cosmos DB**: Loads product catalog data from CSV into Cosmos DB container
3736
> 3. **Creates Azure AI Search Index**: Sets up a search index with vector search capabilities
3837
> 4. **Imports Data to Search**: Populates the search index from Cosmos DB using an indexer
3938
40-
4139
<details>
4240
<summary><b> Prerequisites: </b> (Click to expand)</summary>
4341

@@ -68,6 +66,7 @@ terraform apply -auto-approve
6866
```
6967

7068
This will:
69+
7170
- Deploy all Azure resources
7271
- Create AI model deployments
7372
- Generate `.env` file
@@ -76,17 +75,20 @@ This will:
7675
> Option 2: Run Manually → If you prefer to run the data pipeline manually or separately:
7776
7877
1. **Ensure `.env` file exists** (created by Terraform):
78+
7979
```bash
8080
cd terraform-infrastructure
8181
terraform apply -auto-approve
8282
```
8383

8484
2. **Navigate to src directory**:
85+
8586
```bash
8687
cd ../src
8788
```
8889

8990
3. **Create virtual environment and install dependencies**:
91+
9092
```powershell
9193
python -m venv venv
9294
.\venv\Scripts\Activate.ps1
@@ -95,6 +97,7 @@ This will:
9597
```
9698

9799
4. **Run pipeline scripts in order**:
100+
98101
```powershell
99102
# Step 1: Import data to Cosmos DB
100103
python pipelines/ingest_to_cosmos.py
@@ -115,6 +118,7 @@ src/data/updated_product_catalog(in).csv
115118
```
116119

117120
> Expected columns:
121+
118122
- `ProductID`: Unique product identifier
119123
- `ProductName`: Product name
120124
- `ProductCategory`: Product category
@@ -147,7 +151,6 @@ curl -o src/data/updated_product_catalog(in).csv https://raw.githubusercontent.c
147151

148152
</details>
149153

150-
151154
<details>
152155
<summary><b> pipelines/create_search_index.py </b> (Click to expand)</summary>
153156

@@ -158,7 +161,6 @@ curl -o src/data/updated_product_catalog(in).csv https://raw.githubusercontent.c
158161

159162
</details>
160163

161-
162164
<details>
163165
<summary><b> pipelines/create_search_index.py </b> (Click to expand)</summary>
164166

@@ -196,7 +198,7 @@ curl -o src/data/updated_product_catalog(in).csv https://raw.githubusercontent.c
196198

197199
> For detailed troubleshooting guidance, see [TROUBLESHOOTING.md](../TROUBLESHOOTING.md). Quick Reference:
198200
199-
- **Python Not Found**: Install Python 3.8+ from https://www.python.org/downloads/
201+
- **Python Not Found**: Install Python 3.8+ from <https://www.python.org/downloads/>
200202
- **CSV File Not Found**: Download the product catalog CSV file and place it in `src/data/` directory
201203
- **Authentication Errors**: Run `az login` and ensure you have proper permissions. See [TROUBLESHOOTING.md](../TROUBLESHOOTING.md#azure-authentication-issues) for detailed solutions.
202204
- **Virtual Environment Issues**: Delete `venv` folder and recreate. See [TROUBLESHOOTING.md](../TROUBLESHOOTING.md#python-environment-issues) for details.
@@ -236,6 +238,7 @@ AZURE_OPENAI_EMBEDDING_DEPLOYMENT=text-embedding-3-small
236238
> After running the pipeline, verify data was imported:
237239
238240
## Check Cosmos DB
241+
239242
```powershell
240243
az cosmosdb sql container show \
241244
--account-name <cosmos-account> \
@@ -245,6 +248,7 @@ az cosmosdb sql container show \
245248
```
246249

247250
## Check Search Index
251+
248252
```powershell
249253
az search index show \
250254
--index-name products-index \
@@ -253,6 +257,7 @@ az search index show \
253257
```
254258

255259
## Query Search Index
260+
256261
```powershell
257262
az search index show-statistics \
258263
--index-name products-index \

0 commit comments

Comments
 (0)