Create new environment (3-16 chars, alphanumeric only)

July 23, 2026 · View on GitHub

Option A: VS Code Dev Containers (Recommended)

Open in Dev Containers

⚠️ Note for macOS Developers: If you are using macOS on Apple Silicon (ARM64) the DevContainer will not work. This is due to a limitation with the Azure Functions Core Tools (see here). We recommend using the Option B (Local Environment) instructions below to run the accelerator locally.

Prerequisites:

Steps:

  1. Start Docker Desktop
  2. Click the badge above to open in Dev Containers
  3. Wait for the container to build and start (includes all development tools)
  4. Proceed to Step 3: Configure Azure Resources

💡 Tip: Visual Studio Code should recognize the available development container and ask you to open the folder using it. For additional details on connecting to remote containers, please see the Open an existing folder in a container quickstart.

Option B: Local Environment

Required Tools:

Setup Steps:

  1. Install all required deployment tools listed above

  2. Clone the repository:

    azd init -t chat-with-your-data-solution-accelerator
    
  3. Open the project folder in your terminal

  4. Review the contents of .devcontainer/setupEnv.sh and then run it:

    .devcontainer/setupEnv.sh
    
  5. Select the Python interpreter in Visual Studio Code:

    • Open the command palette (Ctrl+Shift+P or Cmd+Shift+P).
    • Type Python: Select Interpreter.
    • Select the Python 3.11 environment created by uv.
  6. Proceed to Step 3: Configure Azure Resources

PowerShell Users: If you encounter script execution issues, run:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Step 3: Configure Deployment Settings

Review the configuration options below. You can customize any settings that meet your needs, or leave them as defaults to proceed with a standard deployment.

3.1 Choose Deployment Type (Optional)

AspectDevelopment/Testing (Default)Production
Configuration Filemain.parameters.json (sandbox)Copy main.waf.parameters.json to main.parameters.json
Security ControlsMinimal (for rapid iteration)Enhanced (production best practices)
CostLower costsCost optimized
Use CasePOCs, development, testingProduction workloads
FrameworkBasic configurationWell-Architected Framework
FeaturesCore functionalityReliability, security, operational excellence

To use production configuration:

Copy the contents from the production configuration file to your main parameters file:

  1. Navigate to the infra folder in your project
  2. Open main.waf.parameters.json in a text editor (like Notepad, VS Code, etc.)
  3. Select all content (Ctrl+A) and copy it (Ctrl+C)
  4. Open main.parameters.json in the same text editor
  5. Select all existing content (Ctrl+A) and paste the copied content (Ctrl+V)
  6. Save the file (Ctrl+S)

3.2 Set VM Credentials (Optional - Production Deployment Only)

Note: This section only applies if you selected Production deployment type in section 3.1. VMs are not deployed in the default Development/Testing configuration.

By default, random GUIDs are generated for VM credentials. To set custom credentials:

azd env set AZURE_ENV_VM_ADMIN_USERNAME <your-username>
azd env set AZURE_ENV_VM_ADMIN_PASSWORD <your-password>

3.3 Advanced Configuration (Optional)

Configurable Parameters

You can customize various deployment settings before running azd up, including Azure regions, AI model configurations (deployment type, version, capacity), container registry settings, and resource names.

📖 Complete Guide: See Parameter Customization Guide for the full list of available parameters and their usage.

Reuse Existing Resources

To optimize costs and integrate with your existing Azure infrastructure, you can configure the solution to reuse compatible resources already deployed in your subscription.

Supported Resources for Reuse:

  • Log Analytics Workspace: Integrate with your existing monitoring infrastructure by reusing an established Log Analytics workspace for centralized logging and monitoring.

  • Resource Group: Leverage an existing resource group to organize resources within your current Azure infrastructure. Follow the setup steps here before running azd up

Key Benefits:

  • Cost Optimization: Eliminate duplicate resource charges
  • Operational Consistency: Maintain unified monitoring and AI infrastructure
  • Faster Deployment: Skip resource creation for existing compatible services
  • Simplified Management: Reduce the number of resources to manage and monitor

Important Considerations:

  • Ensure existing resources meet the solution's requirements and are in compatible regions
  • Review access permissions and configurations before reusing resources
  • Consider the impact on existing workloads when sharing resources

Step 4: Deploy the Solution

4.1 Authenticate with Azure

azd auth login

For specific tenants:

azd auth login --tenant-id <tenant-id>

Finding Tenant ID:

  1. Open the Azure Portal.
  2. Navigate to Microsoft Entra ID from the left-hand menu.
  3. Under the Overview section, locate the Tenant ID field. Copy the value displayed.

4.2 Start Deployment

NOTE: If you are running the latest azd version (version 1.23.9), please run the following command.

azd config set provision.preflight off
azd up

During deployment, you'll be prompted for:

  1. Environment name (e.g., "cwyd") - Must be 3-16 characters long, alphanumeric only
  2. Azure subscription selection
  3. Location - Select the region where your infrastructure resources will be deployed
  4. Resource group selection (create new or use existing)

Expected Duration: 25-30 minutes for default configuration

4.3 Get Application URL

After successful deployment, locate your application URL:

  1. Open the Azure Portal
  2. Navigate to your resource group
  3. Locate the Container Apps - you will find three services:
    • Frontend: the React web app, with the admin interface built in at the /admin path
    • Backend: the FastAPI API
    • Functions: the ingestion worker
  4. Open the frontend Container App and copy its Application Url from the overview page

Example URLs:

  • Application: https://<frontend-container-app-name>.<region>.azurecontainerapps.io/
  • Admin interface: https://<frontend-container-app-name>.<region>.azurecontainerapps.io/admin

⚠️ Important: Complete Post-Deployment Steps before accessing the application.

Step 5: Post-Deployment Configuration

5.1 Run Post-Deployment Setup Script (Required)

After deployment completes, run the post-deployment script to configure the Function App client key and create PostgreSQL tables (if applicable).

Login to Azure CLI:

The post-deployment script uses Azure CLI (az) commands. Ensure you are logged in before running it:

az login

For specific tenants:

az login --tenant-id <tenant-id>

Important: The post-deployment script requires Azure CLI version 2.87.0 or later.

Check your installed version:

az version

If your version is earlier than 2.87.0, upgrade Azure CLI before running the script:

az upgrade

PowerShell (Windows):

.\infra\scripts\post-provision\post_deployment_setup.ps1 -ResourceGroupName "<your-resource-group-name>"

Bash (Linux/macOS/WSL):

bash infra/scripts/post-provision/post_deployment_setup.sh "<your-resource-group-name>"

Note: The script auto-discovers all resources in the resource group. It handles private networking (WAF) deployments by temporarily enabling public access, performing the setup, then restoring the original state.

5.2 Build, Push, and Update Container Images (Container Model Only)

📌 Skip this step if you deployed with the default hostingModel=code.

When deploying with hostingModel=container, the Container Apps start with a placeholder image. After provisioning, run the combined container workflow to build and push the application images to your Azure Container Registry and update the Container Apps to use them.

PowerShell (Windows):

.\infra\scripts\post-provision\acr_build_push_update.ps1 -ResourceGroupName "<your-resource-group-name>"

Bash (Linux/macOS/WSL):

bash infra/scripts/post-provision/acr_build_push_update.sh -g "<your-resource-group-name>"

This script:

  • Builds and pushes the images to your ACR
  • Updates each Container App to pull its image from your private ACR using managed-identity authentication
  • Restarts all services

By default, images are built remotely using az acr build (no local Docker required). To build locally with Docker instead, use -Mode local in PowerShell or --mode local in Bash. You can also set a custom tag with -Tag or --tag.

Re-deployment note: If you re-run azd provision, run this script again to restore the correct container images.

5.3 Configure Authentication (Required for Chat Application)

This step is mandatory for Chat Application access:

  1. Follow App Authentication Configuration
  2. Wait up to 10 minutes for authentication changes to take effect

5.4 Verify Deployment

  1. Access your application using the URL from Step 4.3
  2. Confirm the application loads successfully
  3. Verify you can sign in with your authenticated account

5.5 Test the Application

Quick Test Steps:

  1. Open the admin interface at the /admin path, where you can upload documents. Select Ingest Data and add your data. You can find sample data in the data directory.
  2. Return to the chat web app to start chatting on top of your data.

Step 6: Clean Up (Optional)

Remove All Resources

azd down

Note: If you deployed with enableRedundancy=true and Log Analytics workspace replication is enabled, you must first disable replication before running azd down else resource group delete will fail. Follow the steps in Handling Log Analytics Workspace Deletion with Replication Enabled, wait until replication returns false, then run azd down.

Manual Cleanup (if needed)

If deployment fails or you need to clean up manually:

Managing Multiple Environments

Recover from Failed Deployment

If your deployment failed or encountered errors, here are the steps to recover:

Recover from Failed Deployment

If your deployment failed or encountered errors:

  1. Try a different region: Create a new environment and select a different Azure region during deployment
  2. Clean up and retry: Use azd down to remove failed resources, then azd up to redeploy
  3. Fresh start: Create a completely new environment with a different name

Example Recovery Workflow:

# Remove failed deployment (optional)
azd down

# Create new environment (3-16 chars, alphanumeric only)
azd env new cwydretry

# Deploy with different settings/region
azd up

Creating a New Environment

If you need to deploy to a different region, test different configurations, or create additional environments:

Create a New Environment

Create Environment Explicitly:

# Create a new named environment (3-16 characters, alphanumeric only)
azd env new <new-environment-name>

# Select the new environment
azd env select <new-environment-name>

# Deploy to the new environment
azd up

Example:

# Create a new environment for production (valid: 3-16 chars)
azd env new cwydprod

# Switch to the new environment
azd env select cwydprod

# Deploy with fresh settings
azd up

Environment Name Requirements:

  • Length: 3-16 characters
  • Characters: Alphanumeric only (letters and numbers)
  • Valid examples: cwyd, test123, myappdev, prod2024
  • Invalid examples: cd (too short), my-very-long-environment-name (too long), test_env (underscore not allowed), myapp-dev (hyphen not allowed)
Switch Between Environments

List Available Environments:

azd env list

Switch to Different Environment:

azd env select <environment-name>

View Current Environment Variables:

azd env get-values

Best Practices for Multiple Environments

  • Use descriptive names: cwyddev, cwydprod, cwydtest (remember: 3-16 chars, alphanumeric only)
  • Different regions: Deploy to multiple regions for testing quota availability
  • Separate configurations: Each environment can have different parameter settings
  • Clean up unused environments: Use azd down to remove environments you no longer need

Deploy Using Bicep Directly

If you prefer not to use azd, you can deploy using the Bicep file directly.

A Bicep file is used to generate the ARM template. You can deploy this accelerator with the following command:

az deployment sub create --template-file ./infra/main.bicep --subscription {your_azure_subscription_id} --location {your_preferred_location}

Next Steps

Now that your deployment is complete and tested, explore these resources to enhance your experience:

📚 Learn More:

Need Help?


Back to Chat with your data README

Supporting documentation

Overview

Chat with Your Data deploys to Azure with the Azure Developer CLI (azd). One command provisions every resource, builds the three container images, deploys them to Azure Container Apps, and seeds a sample corpus so chat works on the first run. There is no portal template and no one-click button to configure.

Estimated time: 20 to 40 minutes, most of which is unattended provisioning.

Prerequisites

Tip

The default AI service region is eastus2. Choose a region that has capacity for the configured models, or set a different region at the prompt.

Deploy with azd

Sign in, then provision and deploy in one step.

azd auth login
azd up

azd up prompts for a few typed parameters and stores them in your azd environment.

PromptValuesNotes
databaseTypecosmosdb (default), postgresqlChooses the retrieval index and chat history platform. Locked after deployment.
azureAiServiceLocationAzure regionRegion for the Azure AI Foundry models. Defaults to eastus2.
enableMonitoringtrue, falseAdds Log Analytics and Application Insights. Defaults to false.
enableScalabilitytrue, falseReliability and scale flag. Defaults to false.
enableRedundancytrue, falseRedundancy flag. Defaults to false.
enablePrivateNetworkingtrue, falseAdds a virtual network, private DNS, and a bastion host. Defaults to false.

See Customizing azd parameters for the complete list of options.

What azd up does

flowchart TD
  A[azd auth login] --> B[azd up]
  B --> C[Provision infra<br/>Bicep main.bicep]
  C --> D[postprovision hook<br/>post-provision script]
  D --> E[Deploy 3 services<br/>images built in ACR remoteBuild]
  E --> F[postdeploy hook<br/>upload-sample-data seeds corpus]
  F --> G[Application URL ready]
  1. Provision. Bicep (infra/main.bicep) creates the resource group contents described in Architecture overview.
  2. Post-provision. A script prepares data-plane state, such as enabling the pgvector extension in postgresql mode or seeding the knowledge base in cosmosdb mode.
  3. Deploy. The backend, frontend, and ingestion images build remotely in the container registry, so you do not need Docker installed. The Container Apps are then updated to the new images.
  4. Post-deploy. A script seeds a sample document set and enqueues it for ingestion so chat returns grounded answers immediately.

When the command finishes, azd prints the application URL.

Deploy changes to a single service

After the first azd up, you can redeploy one service without reprovisioning.

azd deploy backend
azd deploy frontend
azd deploy function

Clean up

Delete every resource created by the deployment when you are done.

azd down

Warning

azd down permanently deletes the deployed resources and all ingested data. Export anything you need first.