Costa Rica
Last updated: 2026-04-06
This guide covers common issues you may encounter when deploying and running this Azure AI Shopping demo application.
Table of Content (Click to expand)
- Python Not Found
- Virtual Environment Creation Failed
- Package Installation Failed
- Not Logged into Azure CLI
- AAD Authentication Failed
- Local Authorization Disabled Error
- Connection Timeout
- CSV File Not Found
- CSV Parsing Error
- Environment File Missing
- Failed to Authenticate to Cosmos DB
- Resource Already Exists
- Insufficient Permissions
- Provider Configuration Error
- State Lock Error
- Enable Verbose Logging
- Check Azure Service Health
- Clean Up and Retry
- Still Having Issues?
ERROR: Python is not installed or not in PATH
Solution:
- Install Python 3.8+ from https://www.python.org/downloads/
- Ensure Python is added to your system PATH during installation
- Verify installation:
python --version
ERROR: Failed to create virtual environment
Solution:
- Ensure you have write permissions to the
srcdirectory - Try deleting existing
venvfolder:Remove-Item -Recurse -Force venv - Check if
python -m venvworks manually:python -m venv test_venv - On Windows, ensure your execution policy allows script execution
ERROR: Could not install packages due to an OSError
Solution:
- Update pip:
python -m pip install --upgrade pip - Clear pip cache:
pip cache purge - Try installing with
--no-cache-dir:pip install --no-cache-dir -r requirements.txt - For Windows + pandas issues, use pre-built wheels by ensuring
pandas>=2.2.2in requirements.txt
ERROR: Please run 'az login' to setup account
Solution:
# Login to Azure CLI
az login
# Verify you're logged in with the correct account
az account show
# If needed, set the correct subscription
az account set --subscription <subscription-id>DefaultAzureCredential failed to retrieve a token
Solution:
- Ensure you're logged into Azure CLI:
az login - Check your account has proper permissions
- Verify the resource exists and you have access
- Try clearing Azure credentials cache:
az account clearthenaz loginagain
ERROR: Local Authorization is disabled. Use an AAD token to authorize all requests.
This error occurs when Cosmos DB requires Azure Active Directory (AAD) authentication instead of key-based authentication.
Common Causes and Solutions:
- Not logged into Azure CLI
# Login to Azure CLI
az login
# Verify you're logged in with the correct account
az account show
# If needed, set the correct subscription
az account set --subscription <subscription-id>After logging in, try running the script again.
- Public Network Access Disabled
If your Cosmos DB has public network access disabled, your local machine or Codespace VM cannot connect.
Solution via Azure Portal:
- Navigate to your Cosmos DB account in the Azure portal
- Select Networking from the Settings menu
- Ensure Public network access is set to All networks
- Click Save
- Wait a few minutes for the change to propagate
- Try running the script again
Solution via Azure CLI:
az cosmosdb update \
--name <cosmos-account-name> \
--resource-group <resource-group-name> \
--enable-public-network true- Insufficient Permissions: Your Azure account needs appropriate role assignments on the Cosmos DB account.
Required roles:
Cosmos DB Built-in Data Contributor(for read/write access)- Or
Contributorat the resource group level
Solution via Azure CLI:
# Get your user object ID
$userId = (az ad signed-in-user show --query id -o tsv)
# Assign Cosmos DB Data Contributor role
az cosmosdb sql role assignment create \
--account-name <cosmos-account-name> \
--resource-group <resource-group-name> \
--role-definition-id 00000000-0000-0000-0000-000000000002 \
--principal-id $userId \
--scope "/"ERROR: Request timeout
Solution:
- Check your network connection
- Verify Cosmos DB firewall settings allow your IP address
- Ensure public network access is enabled (see above)
- Check if Azure services are experiencing outages: https://status.azure.com/
WARNING: CSV data file not found at data/updated_product_catalog(in).csv
Solution: Download or place the product catalog CSV file in the src/data/ directory:
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).csvERROR: Error tokenizing data. C error: Expected X fields, saw Y
Solution:
- Ensure CSV fields with commas are properly quoted
- Check for special characters or encoding issues
- Verify the CSV has the correct number of columns (6): ProductID, ProductName, ProductCategory, ProductDescription, Price, ImageUrl
- Try opening the CSV in a text editor to check for formatting issues
ERROR: .env file not found
Solution:
# Run Terraform to generate the .env file
cd terraform-infrastructure
terraform apply -auto-approveERROR: Failed to authenticate to Cosmos DB using DefaultAzureCredential and no valid COSMOS_DB_KEY was provided
Solution:
- Ensure your
.envfile is properly generated with correct keys - Run
terraform applyagain if needed - Check that
COSMOS_DB_ENDPOINTandCOSMOS_DB_KEYare set correctly in.env - The script will automatically try AAD authentication first, then fall back to key-based auth
ERROR: A resource with the ID already exists
Solution:
- Import the existing resource:
terraform import <resource_type>.<name> <azure_resource_id> - Or destroy and recreate:
terraform destroythenterraform apply - Check for resources in other resource groups with the same name
ERROR: The client does not have authorization to perform action
Solution:
- Ensure your Azure account has
ContributororOwnerrole on the subscription or resource group - Check if specific Azure policies are blocking resource creation
- Contact your Azure administrator to grant necessary permissions
ERROR: Error configuring the backend "azurerm"
Solution:
- Verify your Azure credentials are configured:
az login - Check that the specified subscription exists and you have access
- Ensure the backend storage account and container exist (if using remote state)
ERROR: Error acquiring the state lock
Solution:
# Force unlock (use with caution)
terraform force-unlock <lock-id>Only force-unlock if you're certain no other Terraform process is running.
For more detailed error information:
Azure CLI:
az <command> --debugPython Scripts: Set environment variable before running.
$env:AZURE_LOG_LEVEL = "DEBUG"
python pipelines/script.pyApp (UI error details): Include traceback details in WebSocket error payloads.
$env:A2A_DEBUG = "true"Terraform:
export TF_LOG=DEBUG
terraform applyIf experiencing unexpected issues, check Azure service status
Sometimes a clean slate helps:
# Clean Python environment
Remove-Item -Recurse -Force venv
python -m venv venv
# Clean Terraform state (use with caution)
terraform destroy
Remove-Item -Recurse -Force .terraform
terraform init
terraform applyIf you continue experiencing problems:
- Check the GitHub repository issues
- Review Azure documentation for specific services
- Enable detailed logging as described above
- Collect error messages, logs, and configuration details
- Create a new issue with detailed information about your problem