Your app sits happily on an Azure VM. A user halfway across the world hits it, traffic hops through layers of routing, and somehow you discover that latency and identity are everyone’s problem and nobody’s job. Then you meet Cloudflare Workers, and suddenly you wonder why you ever opened port 22 to the wild.
Azure VMs give you compute power, control, and scale. Cloudflare Workers provide programmable logic at the edge, closer to your users. When you connect them, you turn a static infrastructure service into a dynamic edge-aware system. It’s the kind of setup that makes security reviewers smile because least privilege and global availability finally coexist.
The Azure VMs Cloudflare Workers combination works best when you treat the VM as your reliable engine and the Worker as the traffic brain. The Worker intercepts requests, authenticates via your chosen identity provider (say, Okta or Azure AD), then forwards only approved traffic to your VM. You get consistent policy enforcement regardless of where your users or workloads run.
A simple pattern looks like this:
- The Worker terminates external access, checks auth tokens with OIDC or JWT introspection.
- It routes valid sessions to a private endpoint in your Azure Virtual Network.
- The VM handles the actual compute or sensitive logic, returning only sanitized responses.
- Logs and metrics follow the same edge-aware model, letting Ops trace every call from edge to instance.
Best practices worth remembering
Use managed identities for your Azure services so Workers never store long-lived secrets. Keep RBAC tight, mapping identity roles to function-level permissions rather than global access. Regularly rotate API keys or tokens used for inter-service calls. And when debugging Workers talking to VMs, always verify your firewall rules before blaming DNS.