### Install and Start API Server (TypeScript) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/tutorials/openai-acs-msgraph/includes/Start-Services.md These commands install the necessary dependencies for the API server and then start the server. They are executed within the 'server/typescript' directory of the project. ```bash npm install npm start ``` -------------------------------- ### Start PostgreSQL Database with Podman Compose Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/tutorials/openai-acs-msgraph/includes/Start-Services.md This command starts the PostgreSQL database using Podman Compose. It requires Podman and podman-compose to be installed and running. Similar to Docker Compose, it will pull the necessary image and initiate the container. ```bash podman-compose up ``` -------------------------------- ### Start PostgreSQL Database with Docker Compose Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/tutorials/openai-acs-msgraph/includes/Start-Services.md This command starts the PostgreSQL database using Docker Compose. It assumes Docker Desktop is installed and running. The command will download the PostgreSQL image if it's not already present and configure it to run. ```bash docker-compose up ``` -------------------------------- ### Install Dev Proxy on Linux using setup script Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md Installs Dev Proxy on Linux using a setup script fetched via curl. This is the recommended automated method for Linux. The script handles the necessary downloads and configurations. ```bash bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)" ``` -------------------------------- ### Dev Proxy Startup Output Example Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/check-minimal-api-permissions.md This is an example of the console output when Dev Proxy starts successfully with the `ApiCenterMinimalPermissionsPlugin` configured. It indicates a successful connection to Azure and the listening address. The hotkey information provides guidance on controlling Dev Proxy during operation. ```text info Plugin ApiCenterMinimalPermissionsPlugin connecting to Azure... info Listening on 127.0.0.1:8000... Hotkeys: issue (w)eb request, (r)ecord, (s)top recording, (c)lear screen Press CTRL+C to stop Dev Proxy ``` -------------------------------- ### Example Bash Script to Start Dev Proxy in CI/CD Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-in-ci-cd-overview.md An example bash script demonstrating how to start Dev Proxy in the background within a CI/CD pipeline. It includes steps for creating necessary directories, logging output, exporting the root certificate, and setting proxy environment variables. ```bash log_file=devproxy.log echo "Ensuring Dev Proxy rootCert folder" mkdir -p ~/.config/dev-proxy/rootCert # start Dev Proxy in the background # log Dev Proxy output to the log file # log stdout and stderr to the file echo "Starting Dev Proxy" ./devproxy/devproxy > $log_file 2>&1 & echo "Waiting for Dev Proxy to start..." while true; do if grep -q "Listening on 127.0.0.1:8000" $log_file; then break fi sleep 1 done echo "Exporting the Dev Proxy's Root Certificate" openssl pkcs12 -in ~/.config/dev-proxy/rootCert.pfx -clcerts -nokeys -out dev-proxy-ca.crt -passin pass:"" echo "Installing the Dev Proxy's Root Certificate" sudo cp dev-proxy-ca.crt /usr/local/share/ca-certificates/ echo "Updating the CA certificates" sudo update-ca-certificates echo "Set proxy variables" export http_proxy=http://127.0.0.1:8000 export https_proxy=http://127.0.0.1:8000 ``` -------------------------------- ### Install and Run Dev Proxy Source: https://context7.com/microsoftdocs/microsoft-cloud/llms.txt Provides commands to install Dev Proxy using package managers for Windows, macOS, and Linux. It also includes instructions to start Dev Proxy, send a test request, and stop it safely. You can also start Dev Proxy to watch specific URLs. ```bash # Windows installation winget install DevProxy.DevProxy --silent # macOS installation brew tap dotnet/dev-proxy brew install dev-proxy # Linux installation bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)" # Start Dev Proxy devproxy # Verify it works by sending a test request curl -ikx http://localhost:8000 https://jsonplaceholder.typicode.com/posts # Stop Dev Proxy safely # Press Ctrl+C in the terminal where Dev Proxy is running # Start Dev Proxy with specific URLs to watch devproxy --urls-to-watch "https://your-api.com/*" ``` -------------------------------- ### Install Dev Proxy on Linux using PowerShell Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md Installs Dev Proxy on Linux using PowerShell. This method downloads the setup script and executes it using Invoke-Expression. It provides an alternative automated installation for Linux users who prefer PowerShell. ```powershell (Invoke-WebRequest https://aka.ms/devproxy/setup.ps1).Content | Invoke-Expression ``` -------------------------------- ### Start Dev Proxy Manually Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Starts Dev Proxy manually after it has been installed. This action uses the 'start' action without automatic installation. ```yaml - name: Start Dev Proxy manually uses: dev-proxy-tools/actions/start@v1 ``` -------------------------------- ### Install and Start Dev Proxy with a Custom Log File Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Starts Dev Proxy and directs its output to a custom log file specified by the 'log-file' input. ```yaml - name: Start Dev Proxy with custom log file uses: dev-proxy-tools/actions/start@v1 with: log-file: .devproxy/custom-devproxy.log ``` -------------------------------- ### Install and Start Dev Proxy with a Specific Configuration File Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Starts Dev Proxy using a specified configuration file. The 'config-file' input points to the custom Dev Proxy configuration. ```yaml - name: Start Dev Proxy with config uses: dev-proxy-tools/actions/start@v1 with: config-file: .devproxy/my-config.json ``` -------------------------------- ### Install Dev Proxy Only (Without Starting) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Installs Dev Proxy but prevents it from starting automatically by setting 'auto-start' to 'false'. ```yaml - name: Install Dev Proxy uses: dev-proxy-tools/actions/setup@v1 with: auto-start: false ``` -------------------------------- ### Start OpenLIT OpenTelemetry Collector and Dashboard Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/understand-language-model-usage.md Clones the OpenLIT repository and starts the OpenLIT OpenTelemetry collector and dashboard using Docker Compose. Requires Docker and Git to be installed. The dashboard is accessible at http://127.0.0.1:3000 with default credentials. ```bash # Clone the OpenLIT repository git clone git@github.com:openlit/openlit.git # Start the OpenLIT OpenTelemetry collector and dashboard docker compose up -d ``` -------------------------------- ### Install Dev Proxy on Windows using winget Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md Installs the stable version of Dev Proxy on Windows using the winget package manager. This is the recommended automated method. After installation, the command prompt needs to be restarted to refresh the PATH environment variable. ```console winget install DevProxy.DevProxy --silent ``` -------------------------------- ### Install and Start Dev Proxy in Recording Mode Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Starts Dev Proxy in recording mode by setting the 'auto-record' input to 'true'. This captures requests and responses. ```yaml - name: Start Dev Proxy uses: dev-proxy-tools/actions/start@v1 with: auto-record: true ``` -------------------------------- ### Install Dev Proxy Beta on macOS using Homebrew Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md Installs the beta version of Dev Proxy on macOS using Homebrew. This allows developers to test the latest preview features. After installation, the command prompt needs to be restarted to refresh the PATH environment variable. ```bash brew tap dotnet/dev-proxy brew install dev-proxy-beta ``` -------------------------------- ### Pass Options to Dev Proxy Start Task in tasks.json Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-vs-code-debug-configurations.md Demonstrates how to pass command-line arguments to the Dev Proxy start task within `tasks.json`. This example shows how to enable recording mode by passing the `--record` argument. ```json { "label": "devproxy-start", "type": "devproxy", "command": "start", "args": [ "--record" ], "isBackground": true, "problemMatcher": "$devproxy-watch" } ``` -------------------------------- ### Interact with Simulated API using cURL (Bash) Source: https://context7.com/microsoftdocs/microsoft-cloud/llms.txt Demonstrates how to interact with a simulated API powered by CrudApiPlugin using cURL commands. Shows examples for GET, POST, PATCH, and DELETE operations against the mocked API endpoint. ```bash # GET all customers curl -x http://localhost:8000 https://api.contoso.com/v1/customers # GET one customer curl -x http://localhost:8000 https://api.contoso.com/v1/customers/1 # POST new customer curl -x http://localhost:8000 -X POST https://api.contoso.com/v1/customers \ -H "Content-Type: application/json" \ -d '{"id": 3, "name": "Northwind", "address": "789 Pine St"}' # PATCH update customer curl -x http://localhost:8000 -X PATCH https://api.contoso.com/v1/customers/1 \ -H "Content-Type: application/json" \ -d '{"address": "Updated Address"}' # DELETE customer curl -x http://localhost:8000 -X DELETE https://api.contoso.com/v1/customers/2 ``` -------------------------------- ### Start Dev Proxy and Record API Requests Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/generate-typespec-file.md These console commands initiate the Dev Proxy process and begin recording API requests. 'devproxy' starts the proxy, and pressing 'r' within the running proxy starts the recording. Pressing 's' stops the recording. ```bash devproxy ``` ```bash r ``` ```bash s ``` -------------------------------- ### Start .NET Aspire OpenTelemetry Collector and Dashboard Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/understand-language-model-usage.md Starts the .NET Aspire OpenTelemetry collector and dashboard using Docker. Requires Docker to be installed and running. The command maps ports for the collector and dashboard and names the container 'aspire-dashboard'. ```bash docker run --rm -it -p 18888:18888 -p 4317:18889 -p 4318:18890 --name aspire-dashboard mcr.microsoft.com/dotnet/aspire-dashboard:latest ``` -------------------------------- ### Install Dev Proxy on macOS using Homebrew Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md Installs the stable version of Dev Proxy on macOS using Homebrew. This involves tapping the dotnet/dev-proxy repository and then installing the dev-proxy package. This is the recommended automated method for macOS. ```bash brew tap dotnet/dev-proxy brew install dev-proxy ``` -------------------------------- ### Example Azure Pipeline with Dev Proxy (YAML) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-azure-pipelines.md A complete example Azure Pipeline that installs Dev Proxy, starts it, sends a request through it using curl, stops the proxy, and displays the logs. ```yaml trigger: - main - dev pool: vmImage: ubuntu-latest variables: - name: DEV_PROXY_VERSION value: v1.0.0 steps: - script: bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)" $DEV_PROXY_VERSION displayName: 'Install Dev Proxy' - script: bash ./start.sh displayName: 'Start Dev Proxy' - script: | curl -ikx http://127.0.0.1:8000 https://jsonplaceholder.typicode.com/posts displayName: 'Send request' - script: | curl -X POST http://localhost:8897/proxy/stop displayName: 'Stop Dev Proxy' - script: | echo "Dev Proxy logs:" cat devproxy.log displayName: 'Show Dev Proxy logs' ``` -------------------------------- ### Install Dev Proxy Beta on Windows using winget Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md Installs the beta version of Dev Proxy on Windows using the winget package manager. This allows developers to test the latest preview features. After installation, the command prompt needs to be restarted to refresh the PATH environment variable. ```console winget install DevProxy.DevProxy.Beta --silent ``` -------------------------------- ### Get the URL of the Running Dev Proxy Instance Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Retrieves the URL of the running Dev Proxy instance using the 'proxy-url' output from the 'setup' or 'start' action. ```yaml - name: Setup Dev Proxy id: setup-devproxy uses: dev-proxy-tools/actions/setup@v1 - name: Get Dev Proxy URL run: echo "Dev Proxy URL: ${{ steps.setup-devproxy.outputs.proxy-url }}" ``` -------------------------------- ### Run Dev Proxy for Your App Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md This command demonstrates how to start Dev Proxy and configure it to watch specific URLs used by your application. This is essential for testing Dev Proxy's failure simulation with your own services. ```bash devproxy --urls-to-watch "https://your-api.com/*" ``` -------------------------------- ### Run PostgreSQL Container Directly (Mac/Linux/WSL) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/tutorials/openai-acs-msgraph/includes/Start-Services.md This command runs the PostgreSQL container directly using a container runtime like Docker, Podman, or nerdctl on Mac, Linux, or WSL. It sets up the database with specific user, password, and database name, maps a local data directory, and exposes the default PostgreSQL port. ```bash [docker | podman | nerdctl] run --name postgresDb -e POSTGRES_USER=web -e POSTGRES_PASSWORD=web-password -e POSTGRES_DB=CustomersDB -v $(pwd)/data:/var/lib/postgresql/data -p 5432:5432 postgres ``` -------------------------------- ### Install a Specific Version of Dev Proxy Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Installs a particular version of Dev Proxy by specifying the 'version' input in the 'setup' action. ```yaml - name: Setup Dev Proxy with specific version uses: dev-proxy-tools/actions/setup@v1 with: version: 0.29.2 ``` -------------------------------- ### Setup Dev Proxy in GitHub Actions Workflow Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Installs and sets up Dev Proxy in a GitHub Actions workflow. It uses the 'setup' action from the dev-proxy-tools/actions marketplace. ```yaml - name: Setup Dev Proxy uses: dev-proxy-tools/actions/setup@v1 ``` -------------------------------- ### Start Recording Manually Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions.md Initiates Dev Proxy recording mode manually using the 'record-start' action. ```yaml - name: Start Dev Proxy in recording mode uses: dev-proxy-tools/actions/record-start@v1 ``` -------------------------------- ### Example User Queries for Chat Playground Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/tutorials/openai-acs-msgraph/05-openai-on-your-data.md Demonstrates example user queries to interact with indexed documents in the Chat Playground. These queries are used to retrieve specific information from uploaded files like installation instructions and company policies. ```text What safety rules are required to install a clock? ``` ```text What should I do to mount the clock on the wall? ``` ```text What is the company's policy on vacation time? ``` ```text How should I handle refund requests? ``` -------------------------------- ### Example Generated HTTP File Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/generate-http-file.md This is an example of an HTTP file generated by Dev Proxy's HttpFileGeneratorPlugin. It includes a captured GET request with query parameters and automatically generated variables for sensitive information like API keys. ```http @jsonplaceholder_typicode_com_api_key = api-key ### # @name getPosts GET https://jsonplaceholder.typicode.com/posts?api-key={{jsonplaceholder_typicode_com_api_key}} Host: jsonplaceholder.typicode.com User-Agent: curl/8.6.0 Accept: */* Via: 1.1 dev-proxy/0.29.0 ``` -------------------------------- ### Dev Proxy Request Output (Pass Through) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/get-started/set-up.md This example shows the expected output in the Dev Proxy command line when a request is successfully intercepted and passed through without any simulated errors. It includes details about the request method, URL, timestamp, and the plugins that were skipped. ```text req ╭ GET https://jsonplaceholder.typicode.com/posts time │ 1/31/2025 12:12:14 PM +00:00 skip │ RetryAfterPlugin: Request not throttled skip │ GenericRandomErrorPlugin: Pass through api ╰ Passed through ``` -------------------------------- ### Dev Proxy Command Line Output (Recording) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/check-minimal-api-permissions.md This shows the typical output in the command line when Dev Proxy is running and recording API requests. It indicates the proxy is listening and provides hotkeys for interaction, along with a visual cue that recording is active. ```text info Plugin ApiCenterMinimalPermissionsPlugin connecting to Azure... info Listening on 127.0.0.1:8000... Hotkeys: issue (w)eb request, (r)ecord, (s)top recording, (c)lear screen Press CTRL+C to stop Dev Proxy ◉ Recording... req ╭ GET https://api.northwind.com/customers/ALFKI mock ╰ 200 /{customer-id} ``` -------------------------------- ### Start Dev Proxy Recording Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/generate-http-file.md This command initiates the Dev Proxy process. Once running, users can press 'r' to start recording intercepted API requests and responses, which will be used to generate an HTTP file. ```bash devproxy ``` -------------------------------- ### Install Specific Dev Proxy Version in Azure Pipelines (YAML) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-azure-pipelines.md Installs a specific version of Dev Proxy on an Ubuntu agent by passing the version number to the setup script. This allows for controlled testing with a known Dev Proxy version. ```yaml - script: bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)" v1.0.0 displayName: 'Install Dev Proxy v1.0.0' ``` -------------------------------- ### Install Dev Proxy Certificate for Chromium Browsers (YAML) Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/how-to/use-dev-proxy-with-github-actions-language-model-usage-costs.md For Linux runners using Chromium-based browsers, install the Dev Proxy certificate using the 'chromium-cert' action to prevent SSL errors during request recording. This step should follow the Dev Proxy setup. ```yaml - name: Setup Dev Proxy uses: dev-proxy-tools/actions/setup@v1 with: auto-record: true report-job-summary: $GITHUB_STEP_SUMMARY - name: Install Dev Proxy certificate for Chromium browsers uses: dev-proxy-tools/actions/chromium-cert@v1 - name: Run Playwright tests run: npx playwright test ``` -------------------------------- ### Configure EntraMockResponsePlugin - JSON Source: https://github.com/microsoftdocs/microsoft-cloud/blob/main/docs/dev/dev-proxy/technical-reference/entramockresponseplugin.md Example configuration for the EntraMockResponsePlugin in a JSON file. This setup enables the plugin and specifies the path to its DLL and the configuration section for mock responses. It relies on the MockResponsePlugin for additional configuration options. ```json { "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/rc.schema.json", "plugins": [ { "name": "EntraMockResponsePlugin", "enabled": true, "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", "configSection": "mocksPlugin" } ], "mocksPlugin": { "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/mockresponseplugin.schema.json", "mocksFile": "mocks.json" } } ``` -------------------------------- ### Dev Proxy Configuration File Example Source: https://context7.com/microsoftdocs/microsoft-cloud/llms.txt An example of a `devproxyrc.json` configuration file for Dev Proxy. This file defines plugins to be used, URLs to watch, and specific plugin configurations. The order of plugins in the list is important as they are applied sequentially. ```json { "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/rc.schema.json", "plugins": [ { "name": "RetryAfterPlugin", "enabled": true, "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll" }, { "name": "GenericRandomErrorPlugin", "enabled": true, "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", "configSection": "genericRandomErrorPlugin" } ], "urlsToWatch": [ "https://api.contoso.com/*", "https://graph.microsoft.com/v1.0/*" ], "genericRandomErrorPlugin": { "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/genericrandomerrorplugin.schema.json", "errorsFile": "devproxy-errors.json" }, "rate": 50, "logLevel": "information", "newVersionNotification": "stable", "showSkipMessages": true, "showTimestamps": true } ```