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

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair azure vms and step functions to run multi-cloud jobs across AWS and Azure. AWS Step Functions coordinates the steps, and Azure VMs run heavy compute tasks. This setup lets one state machine manage work across both clouds. You can trigger scripts, process files, and track state from one place. Yet cross-cloud links need tight identity rules and clean network paths to stay safe. How identity and data flow between azure vms and step functions First, the two clouds must trust each oth

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 pair azure vms and step functions to run multi-cloud jobs across AWS and Azure. AWS Step Functions coordinates the steps, and Azure VMs run heavy compute tasks.

This setup lets one state machine manage work across both clouds. You can trigger scripts, process files, and track state from one place. Yet cross-cloud links need tight identity rules and clean network paths to stay safe.

How identity and data flow between azure vms and step functions

First, the two clouds must trust each other before any task runs. Step Functions runs inside AWS and uses an IAM role for its identity. Azure VMs sit inside an Azure resource group and trust Azure identity services.

To link them without static keys, teams set up workload identity federation. Step Functions calls an intermediate AWS function or HTTP task during a run. That task exchanges its AWS token for an Azure token through open standards.

Or, a worker agent on the Azure VM can poll Step Functions for work. In that pattern, the Azure VM logs in to AWS using federation. It pulls the job payload, runs the local script, and sends back the result.

Data payloads should stay small inside the state machine itself. Pass file paths or object references instead of raw records. If payloads carry emails or card numbers, masking rewrites matched fields in results.

Common failure modes and how to scope roles and networks

Cross-cloud setups often fail when teams take shortcuts with keys and roles. The biggest mistake is putting long-lived Azure client secrets inside AWS state inputs. Anyone who can read the Step Functions execution history will see those secrets.

Another common risk is using one shared service account for every VM task. When a job fails or changes data, logs only show the shared account. Your team cannot tell which workflow or person started the command.

Azure RBAC + Cloud Functions IAM: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad permissions make this problem much worse. If the workflow role has contributor rights across Azure, one bug can delete servers. You must scope the role down to the exact VM and action needed.

Network paths between AWS and Azure also need strict rules. Opening public SSH or management ports on Azure VMs invites brute-force attacks. Instead, route traffic over a private cross-cloud link or use outbound polling workers.

Timeouts cause hidden bugs when the two tools get out of sync. An Azure VM script might keep running after the Step Functions state times out. Always set matching timeout limits on both the state machine and the VM script.

Keeping cross-cloud execution logs clear and safe

Tracking a job across two clouds is hard when logs live in two places. Step Functions records state transitions in AWS, while the VM writes local system logs. If a script crashes on the VM, the state machine only sees a generic failure.

You can fix this by sending a shared run ID with every task request. The Azure VM script reads this ID and writes it to every local log line. Then your team can match the AWS state step to the exact VM output.

Make sure your error messages do not leak private data back to AWS. If a script fails while reading phone numbers or national IDs, scrub the output first. Clean logs keep your audit trail safe and easy to search during incidents.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should Step Functions push jobs to Azure VMs or should VMs pull jobs?

Pulling jobs with a worker on the Azure VM is safer for most teams. It avoids opening inbound ports on Azure and handles slow jobs with heartbeats.

How do we avoid storing static Azure keys in AWS?

Use workload identity federation between AWS IAM and your Azure identity provider. This lets workloads trade short-lived identity tokens across clouds without saving passwords.

What happens if an Azure VM reboots during a Step Functions task?

The worker stops sending heartbeats, and Step Functions marks the step as timed out. You can set retry rules in the state machine to run the task again.

The query runs. The emails stay hidden.