The Simplest Way to Make AWS CDK and Azure Functions Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair aws cdk and azure functions to run cross-cloud apps from one codebase. AWS CDK builds cloud stacks while Azure Functions runs event tasks across both clouds. Many groups store core data in Amazon Web Services. The same groups may run serverless code in Microsoft Azure. Linking these two systems lets events flow across clouds without human work. You define the needed cloud roles in code. Then your serverless app reads or writes data when an event fires. How aws cdk and azure functio

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 aws cdk and azure functions to run cross-cloud apps from one codebase. AWS CDK builds cloud stacks while Azure Functions runs event tasks across both clouds.

Many groups store core data in Amazon Web Services. The same groups may run serverless code in Microsoft Azure. Linking these two systems lets events flow across clouds without human work. You define the needed cloud roles in code. Then your serverless app reads or writes data when an event fires.

How aws cdk and azure functions share trust and data

To link aws cdk and azure functions, you use OpenID Connect trust rules. First, your Azure app gets a managed identity from its host cloud. Next, you use AWS CDK to make an identity provider and a role. This AWS role trusts tokens issued by the Azure tenant. When the Azure app runs, it requests a local identity token. It swaps that token for a short AWS session key. No one needs to store static keys in app settings.

Once logged in, the Azure app can send data to AWS queues or storage. You can also flow data in the other direction. An AWS event bus can push alerts to an Azure web endpoint. AWS CDK sets up the event rule and the outbound target. It also stores the shared web secret inside an AWS secret store. Both clouds verify each request before any code runs or data moves.

Common failure modes and how to scope roles

The biggest risk in cross-cloud setups is using shared static keys. Teams often copy a long-term key and paste it into Azure settings. If that key leaks, attackers gain wide permissions inside your AWS account. Another common mistake is granting broad roles to the serverless app. If a role allows all actions, a bug can delete whole tables. Unlogged requests across clouds also make audits hard during security checks.

You can fix these issues by scoping every role in your code. In AWS CDK, grant the Azure role permission to one bucket or queue. Never use wildcards in your role policy rules. Lock the trust rule to the exact identity of one Azure app. On the network side, keep traffic off the public internet when you can. Use private links or site-to-site tunnels between your virtual networks. Turn on cloud audit logs in both accounts to track every request.

AWS CDK Security Constructs + Azure RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing cross-cloud state and deploy pipelines

Running code across two clouds takes a clean deploy plan. AWS CDK builds and updates AWS stacks through CloudFormation. It does not deploy Azure resources out of the box. Most teams run one build pipeline that handles both clouds in steps. The first step sets up the Azure app and reads its identity ID. The second step passes that ID into the AWS CDK build run.

This order ensures the AWS trust rule always has the right Azure identity. Store these output values in a central pipeline variable store. Do not hardcode tenant IDs or app IDs in your source files. If a developer changes an Azure app, the pipeline updates the AWS role. Keeping both steps in one pipeline stops drift between your two cloud accounts. Your team gets a clear record of every cross-cloud change.

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

Can AWS CDK deploy Azure Functions directly?

No, AWS CDK compiles down to AWS CloudFormation templates. To build Azure resources with similar code, use a multi-cloud tool or run a two-step pipeline.

How does an Azure Function log in to AWS without static keys?

Give the Azure app a managed identity and set up OpenID Connect in AWS. The function trades its Azure token for a short-term AWS role session.

How do we restrict network traffic between the two clouds?

Put your Azure app in a virtual network and set up a private cross-cloud tunnel. Then add a network condition to your AWS role policy.

The query runs. The emails stay hidden.