The Simplest Way to Make Azure VMs and Selenium Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams use azure vms and selenium to run automated browser tests in the cloud. The cloud machines host real browsers while the test scripts drive user actions. This setup lets developers test web apps across many browser types at once. Teams do not need to maintain local machines for their test suites. Instead, they spin up cloud servers when a build starts. When the test run ends, they shut the servers down to save money. How azure vms and selenium handle logins and data A build server start

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams use azure vms and selenium to run automated browser tests in the cloud. The cloud machines host real browsers while the test scripts drive user actions.

This setup lets developers test web apps across many browser types at once. Teams do not need to maintain local machines for their test suites. Instead, they spin up cloud servers when a build starts. When the test run ends, they shut the servers down to save money.

How azure vms and selenium handle logins and data

A build server starts the test workflow. It calls the cloud API to start one or more virtual machines. To do this, the build server uses a managed identity or service role. This role gives permission to start, stop, or read the virtual machines.

Once the virtual machine boots, it starts the browser driver service. The test runner on the build server sends commands over the network. Each command tells the remote browser to click a button or fill a form. The remote browser runs the step against the staging web app. Then the virtual machine sends the test results and screenshots back to the runner.

All traffic between the test runner and the virtual machine needs strong rules. Teams place both systems inside the same private virtual network. This setup keeps test traffic off the public internet. It also stops outside users from reaching the open browser driver ports.

Common failure modes and how to scope roles

Many teams make mistakes when they first link these two tools. A common error is opening the browser driver port to the whole internet. Attackers scan for open test ports and use the browsers to run bad code. Another mistake is using one shared admin key for every test machine. If that key leaks, an attacker can control every machine in the cloud account.

Teams also run into trouble when test scripts hold raw app passwords. Developers often put test user logins right inside the code repo. Plus, shared virtual machines often keep old browser cache and cookies between runs. One test can read leftover data from an earlier test and fail.

Azure RBAC + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

To fix these risks, scope down both network paths and cloud roles. Place the virtual machines in a private subnet with strict firewall rules. Only allow traffic on the browser port from the build server address. Give the build server a minimal role that only controls test machines.

Do not reuse virtual machines across different test runs. Boot a fresh machine from a clean image for every single build. Fetch test app logins from a secret store when the test starts. Wipe the machine right after the test finishes sending its logs.

How to keep browser tests fast and stable

Browser tests use a lot of memory and processor power. If a virtual machine is too small, the browser will freeze or crash. Pick a machine size with enough memory for the browser and operating system. Run one browser window per machine to keep CPU load steady.

Screen settings also matter for headless and full browser runs. Set a fixed screen size on the virtual machine before the test starts. If the screen is too small, buttons might hide behind menus. The script will fail to click them and break the build.

Always collect browser logs and system metrics during the test run. Send those logs to a central store before you delete the machine. When a test fails, developers can read the logs to find the bug. They do not need to log in to the machine by hand.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Should I run browsers in headless mode on cloud machines?

Headless mode uses less memory and runs faster for most standard checks. Use a full desktop display only when you must test visual layout bugs.

How do I stop test machines from wasting cloud budget?

Set an automatic shutdown rule on every test virtual machine at creation time. Have your build pipeline delete the machine as its final step.

How should test scripts get logins for the staging app?

Store test user logins in a cloud secret store instead of your code. Have the test runner read the secret at runtime and pass it in.

The query runs. The emails stay hidden.