Skip to content

Separate Azure Envs for Dev/Prod#137

Open
moconnell wants to merge 2 commits into
developfrom
127-azure-environments-should-be-segregated
Open

Separate Azure Envs for Dev/Prod#137
moconnell wants to merge 2 commits into
developfrom
127-azure-environments-should-be-segregated

Conversation

@moconnell

@moconnell moconnell commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Environment-scoped deployments for development vs production using separate Key Vaults and monitoring.
    • Improved deployment validation, admin smoke testing, and production promotion safeguards.
  • Bug Fixes

    • Hardened environment naming and secret/key-vault reference wiring for consistent per-environment behavior.
  • Documentation

    • Reworked Azure deployment and Key Vault secret setup guides, including an environment isolation model.
    • Updated configuration and wallet/credential documentation to match the new secret naming approach.
  • Chores

    • Simplified CI/test behavior and Dependabot targeting.
    • Removed temporary Function cleanup automation; updated the Functions deployment workflow.

@moconnell moconnell self-assigned this Jul 14, 2026
@moconnell moconnell linked an issue Jul 14, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR changes Azure deployment from ephemeral PR environments to separate long-lived development and production environments, adds environment-aware infrastructure and Key Vault wiring, refactors deployment automation, and updates CI, scripts, and operational documentation.

Changes

Azure environment deployment migration

Layer / File(s) Summary
Infrastructure and secret contracts
.azure/app-insights.bicep, .azure/key-vault.bicep, .azure/function-app.bicep
Bicep templates add environment tags, required Key Vault configuration and outputs, and fixed secret-reference paths.
Environment selection and deployment orchestration
.github/workflows/deploy-azure-functions.yml, .github/workflows/cleanup-azure-functions.yml
Deployment selects and validates dev or prod, provisions resources, grants managed-identity access, deploys the Function App, and runs a polling smoke test; the cleanup workflow is removed.
CI and update workflow policy
.github/workflows/dotnet.yml, .github/dependabot.yml
Dependabot targets develop; CI excludes integration tests and removes the Dependabot comment step.
Environment and secret operating model
docs/AZURE-KEY-VAULT-SECRETS-SETUP.md, docs/CONFIGURATION-ARCHITECTURE.md, docs/DEPLOYMENT.md, docs/HYPERLIQUID-WALLET-ARCHITECTURE.md
Documentation describes separate environment vaults, neutral secret names, access isolation, deployment and migration procedures, rollback, and wallet credential separation.
Foundation provisioning scripts
scripts/setup-azure.sh, scripts/generate-eth-keypair.py
Azure setup becomes an argument-driven foundation provisioner, and keypair output uses environment-neutral secret commands and separate credentials guidance.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant EnvironmentSelection
  participant AzureDeployment
  participant AzureResources
  participant FunctionApp
  GitHubActions->>EnvironmentSelection: select branch or manual environment
  EnvironmentSelection->>AzureDeployment: validate ref and deployment environment
  AzureDeployment->>AzureResources: provision Key Vault, monitoring, and Function App
  AzureResources-->>AzureDeployment: return Function App identity and name
  AzureDeployment->>FunctionApp: grant Key Vault access and deploy package
  AzureDeployment->>FunctionApp: poll admin endpoint
Loading

Possibly related PRs

  • moconnell/yolo#83: Earlier Azure IaC changes for Function App secret wiring and Application Insights configuration.
  • moconnell/yolo#84: Related cleanup workflow changes for Azure Function App and App Service Plan deletion.
  • moconnell/yolo#97: Related Function deployment and Key Vault URI/reference wiring changes.

Suggested labels: .NET

Suggested reviewers: dependabot[bot]

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: separating Azure environments into dev and prod.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 127-azure-environments-should-be-segregated

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
.azure/function-app.bicep (1)

1-2: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Constrain environmentName to dev/prod in all three Bicep templates. All three templates document environmentName as "dev or prod" but rely on caller discipline rather than enforcing it, so a typo'd value would silently mistag resources instead of failing the deployment.

  • .azure/function-app.bicep#L1-L2: add @allowed(['dev', 'prod']) above param environmentName string.
  • .azure/app-insights.bicep#L4-L8: add the same @allowed(['dev', 'prod']) decorator.
  • .azure/key-vault.bicep#L4-L5: add the same @allowed(['dev', 'prod']) decorator.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.azure/function-app.bicep around lines 1 - 2, Constrain the environmentName
parameter to the supported values by adding the allowed decorator for dev and
prod in .azure/function-app.bicep lines 1-2, .azure/app-insights.bicep lines
4-8, and .azure/key-vault.bicep lines 4-5. Keep the existing parameter names and
types unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.azure/key-vault.bicep:
- Around line 20-31: Decide and implement an explicit network-access
architecture for the Key Vault configuration in the resource properties: either
retain public access with documented restrictions, or enforce private
connectivity/static egress allowlisting while preserving the documented manual
secret-update workflow. Update publicNetworkAccess and networkAcls consistently,
and ensure GitHub-hosted runners or operator machines can still reach the vault
through the chosen approved path.

In @.github/workflows/deploy-azure-functions.yml:
- Around line 33-58: Update the “Select and validate environment” step to pass
github.event_name, inputs.environment, and github.ref through the step’s env
block, then reference the resulting shell variables instead of interpolating
GitHub expressions inside run. Apply the same pattern to later deploy-job vars.*
and steps.*.outputs values that are inserted directly into shell scripts,
preserving the existing environment-selection and validation behavior.

In `@scripts/generate-eth-keypair.py`:
- Around line 55-62: Remove the unnecessary f-string prefixes from the
non-interpolated print statements in the keypair output block, including the
Azure Key Vault command lines surrounding the interpolated address line. Keep
the interpolated print unchanged and preserve the generated command text.

---

Nitpick comments:
In @.azure/function-app.bicep:
- Around line 1-2: Constrain the environmentName parameter to the supported
values by adding the allowed decorator for dev and prod in
.azure/function-app.bicep lines 1-2, .azure/app-insights.bicep lines 4-8, and
.azure/key-vault.bicep lines 4-5. Keep the existing parameter names and types
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f86c7ad-fc7f-4d7f-8306-74f3bcae0b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 50a8ba3 and 21d4767.

📒 Files selected for processing (13)
  • .azure/app-insights.bicep
  • .azure/function-app.bicep
  • .azure/key-vault.bicep
  • .github/dependabot.yml
  • .github/workflows/cleanup-azure-functions.yml
  • .github/workflows/deploy-azure-functions.yml
  • .github/workflows/dotnet.yml
  • docs/AZURE-KEY-VAULT-SECRETS-SETUP.md
  • docs/CONFIGURATION-ARCHITECTURE.md
  • docs/DEPLOYMENT.md
  • docs/HYPERLIQUID-WALLET-ARCHITECTURE.md
  • scripts/generate-eth-keypair.py
  • scripts/setup-azure.sh
💤 Files with no reviewable changes (2)
  • .github/workflows/cleanup-azure-functions.yml
  • .github/workflows/dotnet.yml

Comment thread .azure/key-vault.bicep
Comment thread .github/workflows/deploy-azure-functions.yml Outdated
Comment thread scripts/generate-eth-keypair.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/deploy-azure-functions.yml (1)

278-278: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Prevent script termination on curl network errors.

Because GitHub Actions uses set -e by default in bash scripts, if curl fails to connect (e.g., DNS not yet propagated or connection refused during app startup), the command exits with a non-zero status. This causes the entire step to abort immediately, bypassing your retry loop.

Append || true inside the subshell to safely swallow network failures, ensuring the status remains empty and the loop continues as intended.

♻️ Proposed fix
-            STATUS=$(curl --silent --output /dev/null --write-out "%{http_code}" "https://$HOSTNAME/admin/functions")
+            STATUS=$(curl --silent --output /dev/null --write-out "%{http_code}" "https://$HOSTNAME/admin/functions" || true)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/deploy-azure-functions.yml at line 278, Update the curl
status assignment in the deployment retry loop to tolerate network failures
under set -e by appending a failure fallback inside the command substitution.
Preserve the existing HTTP status capture while ensuring failed requests leave
STATUS empty and allow the loop to continue.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/deploy-azure-functions.yml:
- Line 278: Update the curl status assignment in the deployment retry loop to
tolerate network failures under set -e by appending a failure fallback inside
the command substitution. Preserve the existing HTTP status capture while
ensuring failed requests leave STATUS empty and allow the loop to continue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2fd87534-3a67-4236-97ac-33243de41a67

📥 Commits

Reviewing files that changed from the base of the PR and between 21d4767 and 14e9ddc.

📒 Files selected for processing (6)
  • .azure/app-insights.bicep
  • .azure/function-app.bicep
  • .azure/key-vault.bicep
  • .github/workflows/deploy-azure-functions.yml
  • docs/AZURE-KEY-VAULT-SECRETS-SETUP.md
  • scripts/generate-eth-keypair.py
🚧 Files skipped from review as they are similar to previous changes (5)
  • .azure/app-insights.bicep
  • docs/AZURE-KEY-VAULT-SECRETS-SETUP.md
  • .azure/function-app.bicep
  • .azure/key-vault.bicep
  • scripts/generate-eth-keypair.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure environments should be segregated

1 participant