Skip to content

Conversation

@keshava-kandikonda
Copy link

@keshava-kandikonda keshava-kandikonda commented Nov 5, 2025

This PR adds flexible VNet and subnet deployment support with three scenarios:

  • New VNet + new subnets - Creates everything from scratch
  • Existing VNet + new subnets - Creates subnets in existing VNet
  • Existing VNet + existing subnets - Adds delegations to existing subnets without changing address ranges

Changes

  • Added parameters: useExistingVnet, createSubnets, vnetAddressPrefix
  • Added variables: subnetAddressForApp, subnetAddressForDb
  • Added add_delegations deployment that uses reference() to preserve existing subnet address ranges
  • Removed CDN references (deprecated)

- Support three scenarios: new VNet, existing VNet with new subnets, existing VNet with existing subnets
- Add parameters: useExistingVnet, createSubnets, vnetAddressPrefix, subnet addresses
- Add update_existing_subnets nested deployment for subnet delegation updates
- Remove hardcoded resource group/subscription IDs
- Remove CDN-related resources
@keshava-kandikonda keshava-kandikonda force-pushed the kkandikonda/vnet-subnet-flexible-deployment branch from 6c82611 to 7311673 Compare November 5, 2025 13:02
@vkarasala
Copy link
Collaborator

LGTM, but please add some testing evidence demonstrating the default flow and existing vnet/subnet flows.

@keshava-kandikonda keshava-kandikonda force-pushed the kkandikonda/vnet-subnet-flexible-deployment branch 2 times, most recently from 01b03e6 to 8e49e1a Compare November 11, 2025 06:27
Keshava Kandikonda added 2 commits November 11, 2025 23:41
Use reference() function to read existing subnet addressPrefix instead of omitting it.
Remove unused useExistingPrivateDnsZone parameter and update documentation.
@keshava-kandikonda keshava-kandikonda force-pushed the kkandikonda/vnet-subnet-flexible-deployment branch from 8e49e1a to e089d3a Compare November 11, 2025 18:20
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"condition": "[or(not(parameters('useExistingVnet')), parameters('createSubnets'))]",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]"

Choose a reason for hiding this comment

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

This should wait for the VNet to be created when provisioning new VNet resource i.e., useExistingVnet is false.

},
{
"type": "Microsoft.Resources/deployments",
"name": "subnet_Resources",

Choose a reason for hiding this comment

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

The template might try to create the subnets in the Resource Group where the deployment is running. Can you verify this scenario: Use existing VNet from a different RG and create new subnet resources ?

Copy link

@siriande siriande left a comment

Choose a reason for hiding this comment

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

Could you also add all the validated test cases in the PR description?

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.

3 participants