This document explains the automated setup process for local development of the Azure AI Search Multimodal RAG Demo.
The application now includes automated scripts that generate the necessary .env file for local development by fetching API keys and configuration from your deployed Azure resources.
When you run azd up, the deployment process automatically:
- Provisions all Azure resources (AI Services, Search, Storage, etc.)
- Deploys the application to Azure App Service
- Runs the data ingestion process
- Automatically generates a local
.envfile with all necessary configuration
If you need to generate or regenerate the .env file for an existing deployment:
scripts/setup-local-env.ps1 -EnvironmentName <YOUR_ENVIRONMENT_NAME>./scripts/setup-local-env.sh --environment <YOUR_ENVIRONMENT_NAME>The setup scripts automatically configure the following in your .env file:
- Azure OpenAI: Endpoint, API key, model names, and deployment names
- Azure AI Search: Endpoint, API key, and index name
- Document Intelligence: Endpoint and API key
- Azure Storage: Account URL and container names
- Azure AI Inference: Embedding endpoint, API key, and model name
HOST=localhostPORT=5000AZURE_TENANT_ID(automatically detected)
- Performance settings (timeouts, concurrency limits)
- Security settings (CORS, rate limiting)
- Monitoring settings (logging, health checks)
- Resilience settings (circuit breaker, retry policies)
For local development, you may need to set up service principal authentication:
- The scripts automatically set
AZURE_TENANT_ID - You need to manually set
AZURE_CLIENT_IDandAZURE_CLIENT_SECRETif required
To create a service principal:
az ad sp create-for-rbac --name "MyApp" --role contributor --scopes /subscriptions/<subscription-id>/resourceGroups/<resource-group>-EnvironmentName: Azure environment name (default: from$env:AZURE_ENV_NAME)-ResourceGroupName: Resource group name (default: auto-detected)-Force: Overwrite existing.envfile without prompting
--environment: Azure environment name--resource-group: Resource group name--force: Overwrite existing.envfile without prompting--help: Show usage information
- Missing API keys: If some API keys are empty, ensure you have the necessary permissions to access the resources
- Authentication errors: Make sure you're logged in to both Azure CLI (
az login) and Azure Developer CLI (azd auth login) - Resource not found: Verify the environment name and resource group are correct
Your user account needs the following Azure RBAC roles:
- Cognitive Services User (for AI Services and OpenAI)
- Search Service Contributor (for Search service)
- Storage Blob Data Contributor (for Storage account)
The infrastructure has been updated to support local development:
- Changed
disableLocalAuthfromtruetofalseto enable API key access for local development - Production deployments still use managed identity for security
- Added service names to infrastructure outputs for script automation
- Added
AZURE_TENANT_IDoutput for service principal configuration
The deployment now outputs all necessary values for local development while maintaining security best practices for production.