Skip to content

Private endpoint support for container apps #2322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Aug 4, 2025

Conversation

pamelafox
Copy link
Collaborator

@pamelafox pamelafox commented Feb 3, 2025

Purpose

This PR adds private networking support for Azure Container Apps, plus a P2S VPN Gateway with Azure Private DNS resolver for local development inside the virtual network.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[X] No

Type of change

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.

@pamelafox
Copy link
Collaborator Author

Blocking: Azure/bicep-registry-modules#4387

@faaraan-farid-kazi
Copy link

Request to Make Existing Container Private Post Deployment

Hi Pamela,

We are currently facing an issue regarding the privacy of our deployed container. Our organization requires that this container be private due to internal policy and data sensitivity concerns.

Current Status:

  • The application is already deployed and actively used by approximately 1,200 users.
  • A significant amount of data has already been uploaded and is in use.

Requirement:

We need a solution that allows us to make the existing container private without disrupting the current deployment or user access.

Open Questions:

  • Is there a way to retroactively apply privacy settings to the existing container?
  • Would migrating to App Services provide a more secure or manageable solution for our use case?

We would appreciate guidance on the best approach to achieve this while minimizing impact on our users and data.

Thanks,
Faaraan

Copy link

Check Broken URLs

We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.

Check the file paths and associated broken URLs inside them.
For more details, check our Contributing Guide.

File Full Path Issues
docs/deploy_private.md
#LinkLine Number
1https://learn.microsoft.com/azure/vpn-gateway/vpn-gateway-howto-vpn-client-install82

@pamelafox pamelafox marked this pull request as ready for review July 30, 2025 06:31
@pamelafox pamelafox requested a review from Copilot July 30, 2025 06:31
Copilot

This comment was marked as outdated.

Copy link

Check Broken URLs

We have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue.

Check the file paths and associated broken URLs inside them.
For more details, check our Contributing Guide.

File Full Path Issues
docs/deploy_private.md
#LinkLine Number
1https://learn.microsoft.com/azure/vpn-gateway/vpn-gateway-howto-vpn-client-install82

@pamelafox pamelafox changed the title Draft PR: Private endpoint support for container apps Private endpoint support for container apps Jul 30, 2025
@pamelafox pamelafox requested a review from Copilot July 31, 2025 00:32
Copilot

This comment was marked as outdated.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds private networking support for Azure Container Apps, enabling deployment with private endpoints and optional VPN gateway configuration for secure access. The changes primarily focus on extending the existing private endpoint functionality from App Service to Container Apps and adding VPN gateway support for local development access.

  • Extends private endpoint support to Container Apps deployment target
  • Adds P2S VPN Gateway with Azure Private DNS resolver for secure local development access
  • Refactors network isolation infrastructure to support both App Service and Container Apps with consistent subnet management

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
infra/private-endpoints.bicep Updates parameter naming from subnet name to subnet ID and improves DNS zone naming
infra/network-isolation.bicep Major refactor to support Container Apps with NSGs, VPN gateway, and DNS resolver
infra/main.parameters.json Adds VPN gateway parameter and removes deprecated Container Apps workload profile
infra/main.bicep Extends private endpoint logic to Container Apps and adds VPN gateway configuration
infra/core/storage/storage-account.bicep Minor syntax update using null coalescing operator
infra/core/host/container-registry.bicep New module for Container Registry with VNet integration support
infra/core/host/container-apps.bicep Simplified Container Apps module with better parameter handling
infra/core/host/container-apps-environment.bicep New dedicated module for Container Apps environment configuration
infra/core/host/container-app.bicep Removes deprecated workload profile parameter
infra/core/host/container-app-upsert.bicep Removes deprecated workload profile parameter
infra/abbreviations.json Adds abbreviation for private DNS resolver
docs/deploy_private.md Updated deployment instructions for VPN gateway usage
app/backend/prepdocs.py Adds connectivity check for search service with VPN guidance
Comments suppressed due to low confidence (1)

infra/core/host/container-apps-environment.bicep:13

  • The API version '2025-02-02-preview' appears to be from the future. As of my knowledge cutoff in January 2025, this version may not exist. Consider using a stable API version like '2024-03-01' or verify that this preview version is available.
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2025-02-02-preview' = {

infra/main.bicep Outdated
@@ -1352,3 +1375,5 @@ output BACKEND_URI string = deploymentTarget == 'appservice' ? backend.outputs.u
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = deploymentTarget == 'containerapps'
? containerApps.outputs.registryLoginServer
: ''

output AZURE_VPN_CONFIG_DOWNLOAD_LINK string = useVpnGateway ? 'https://portal.azure.com/#@${tenant().tenantId}/resource/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroup.name}/providers/Microsoft.Network/virtualNetworkGateways/${isolation.outputs.virtualNetworkGatewayName}/pointtositeconfiguration' : ''
Copy link
Preview

Copilot AI Jul 31, 2025

Choose a reason for hiding this comment

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

This line has inconsistent indentation - it appears to have extra leading spaces compared to the previous output statement.

Suggested change
output AZURE_VPN_CONFIG_DOWNLOAD_LINK string = useVpnGateway ? 'https://portal.azure.com/#@${tenant().tenantId}/resource/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroup.name}/providers/Microsoft.Network/virtualNetworkGateways/${isolation.outputs.virtualNetworkGatewayName}/pointtositeconfiguration' : ''
output AZURE_VPN_CONFIG_DOWNLOAD_LINK string = useVpnGateway ? 'https://portal.azure.com/#@${tenant().tenantId}/resource/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroup.name}/providers/Microsoft.Network/virtualNetworkGateways/${isolation.outputs.virtualNetworkGatewayName}/pointtositeconfiguration' : ''

Copilot uses AI. Check for mistakes.

infra/main.bicep Outdated
@@ -1352,3 +1375,5 @@ output BACKEND_URI string = deploymentTarget == 'appservice' ? backend.outputs.u
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = deploymentTarget == 'containerapps'
? containerApps.outputs.registryLoginServer
: ''

output AZURE_VPN_CONFIG_DOWNLOAD_LINK string = useVpnGateway ? 'https://portal.azure.com/#@${tenant().tenantId}/resource/subscriptions/${subscription().subscriptionId}/resourceGroups/${resourceGroup.name}/providers/Microsoft.Network/virtualNetworkGateways/${isolation.outputs.virtualNetworkGatewayName}/pointtositeconfiguration' : ''
Copy link
Collaborator

Choose a reason for hiding this comment

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

virtual network gateway resource id


param usePrivateIngress bool = true

@allowed(['Consumption', 'D4', 'D8', 'D16', 'D32', 'E4', 'E8', 'E16', 'E32', 'NC24-A100', 'NC48-A100', 'NC96-A100'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice :)

Copy link
Collaborator

@mattgotteiner mattgotteiner left a comment

Choose a reason for hiding this comment

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

Thanks for your efforts here

@pamelafox pamelafox merged commit 8f998ed into Azure-Samples:main Aug 4, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants