Introduction to Azure Delegated Subnets

Welcome to the channel. Please consider subscribing. I produce videos daily covering a wide variety of cloud topics with focus on networking.

Also, hit the bell icon to get notified of new videos.

Today, we're diving into Azure Delegated Subnets, a powerful networking feature that many Azure professionals overlook. If you've ever wondered how Azure manages to seamlessly integrate PaaS services into your virtual networks, delegated subnets are the secret sauce that makes it all work.

Think of delegated subnets as specialized parking spots in your virtual network parking lot. Just like how handicapped parking spaces are reserved for specific use, delegated subnets are reserved exclusively for specific Azure services. When you delegate a subnet, you're essentially saying, "This subnet is reserved for Azure SQL Managed Instance" or "This subnet is dedicated to Azure Container Instances."

The beauty of this approach is that it allows Azure PaaS services, which traditionally live outside your virtual network, to have a presence inside your network while maintaining their managed nature. This gives you the best of both worlds: the convenience of managed services with the security and control of private networking.

In this presentation, we'll explore how delegated subnets work, which services support them, and how to implement them effectively in your Azure architecture. We'll also cover common pitfalls and best practices I've learned from implementing these in production environments.

What Are Delegated Subnets?

Let me explain delegated subnets in simple terms. When you create a subnet in Azure, it's typically a general-purpose subnet where you can deploy virtual machines, load balancers, and various other resources. However, some Azure PaaS services need special treatment - they need their own dedicated space within your virtual network to operate properly.

A delegated subnet is a subnet that you've dedicated to a specific Azure service. Once delegated, only that particular service can deploy resources into that subnet. It's like having a VIP section at a concert - only certain people (or in this case, services) are allowed in.

The key characteristics shown on this slide are crucial to understand. First, delegation is exclusive - you can't mix and match services in a delegated subnet. If you delegate a subnet to Azure SQL Managed Instance, you can't also put Container Instances in there. Second, the service takes control of certain networking aspects, like Network Security Group rules and route tables, to ensure proper functionality.

The diagram illustrates how a virtual network can contain both regular subnets (where your VMs live) and delegated subnets (where specific PaaS services reside). Notice how each delegated subnet is tied to exactly one service type. This separation is not just a best practice - it's enforced by Azure.

One thing that surprises many people is that not all Azure services support subnet delegation. Services need to be specifically designed to work with this feature. As we'll see in upcoming slides, the list of supported services is growing, but it's still limited to services that truly benefit from this level of network integration.

Key Benefits of Delegated Subnets

Now let's talk about why you should care about delegated subnets. The benefits are significant, especially if you're running enterprise workloads with strict security requirements.

The first and most important benefit is network isolation. When PaaS services run in delegated subnets, they're truly inside your virtual network. This means traffic between your VMs and these services doesn't traverse the public internet or even Microsoft's backbone network - it stays within your VNet. I've worked with financial services clients where this level of isolation was a regulatory requirement, not just a nice-to-have.

Private connectivity is closely related but worth calling out separately. With delegated subnets, your PaaS services get private IP addresses from your address space. This eliminates the need for complex firewall rules based on public IP addresses. Your applications can connect using private IPs, just like they would to any other resource in your network.

The simplified network security is a game-changer. Instead of managing IP whitelists and firewall rules, you can use Network Security Groups and route tables (with some limitations) to control traffic. This integrates beautifully with your existing network security strategy.

Enhanced compliance capabilities come from having better control and visibility. When services run in your network, you can apply your network policies, monitoring, and logging consistently. Many compliance frameworks require this level of control over data flows.

Better integration with on-premises networks is often overlooked but crucial for hybrid scenarios. Services in delegated subnets can be accessed from on-premises over ExpressRoute or VPN without additional configuration. This seamless connectivity is essential for lift-and-shift scenarios or gradual cloud migrations.

Services Supporting Subnet Delegation

Let's look at the Azure services that currently support subnet delegation. This list has grown significantly over the past few years, and Microsoft continues to add more services.

Azure SQL Managed Instance was one of the first services to support delegation and remains one of the most popular use cases. When you deploy a Managed Instance, it requires a dedicated subnet with specific requirements. The service needs at least 32 IP addresses, but Microsoft recommends a /27 subnet (32 addresses) for production deployments. This might seem like a lot, but the service uses these IPs for internal operations, high availability, and scaling.

Azure Container Instances (ACI) with VNet integration is another fantastic use case. When you delegate a subnet to ACI, your containers get private IP addresses and can communicate with other resources in your VNet without exposing them to the internet. This is perfect for batch processing jobs or microservices that need to stay private.

Azure NetApp Files requires delegation for its volume endpoints. This enterprise-grade file storage service uses delegated subnets to provide high-performance file shares accessible via SMB and NFS protocols directly within your VNet.

Web App VNet Integration has evolved significantly. The newer VNet integration feature requires a delegated subnet, replacing the older point-to-site based integration. This provides better performance and reliability for your App Service applications.

Azure Spring Cloud, API Management (in internal mode), Azure Databricks, and Azure Monitor Private Link Scope all support subnet delegation. Each service has specific requirements and limitations, which we'll explore in the implementation section.

It's important to note that this list is not exhaustive and Microsoft regularly adds new services. Always check the latest documentation for the most current list.

How Delegation Works

Understanding the technical mechanics of subnet delegation will help you troubleshoot issues and design better architectures. Let me walk you through what happens behind the scenes.

When you delegate a subnet, you're essentially granting a specific Azure service permission to manage that subnet. The delegation is recorded as a property of the subnet itself. This is why you can see the delegation status in the portal, CLI, or ARM templates.

The service registration process begins when you first deploy a resource into the delegated subnet. The Azure service provider registers with your subnet and begins managing certain aspects of the network configuration. This includes injecting routes, managing Network Security Group rules, and controlling IP address allocation.

One critical aspect is that the service becomes the authoritative manager for certain network policies. For example, when you delegate a subnet to Azure SQL Managed Instance, the service will automatically add NSG rules required for its operation. You can add additional rules, but you cannot remove or modify the service-managed rules.

The IP address management is particularly interesting. While the addresses come from your subnet's range, the service controls how they're allocated. Some services, like SQL Managed Instance, reserve blocks of addresses for internal use. Others, like Container Instances, allocate addresses more dynamically.

The diagram shows this relationship clearly. Your subnet maintains its connection to the VNet and inherits route tables and NSGs, but the delegated service adds its own requirements on top. This layered approach ensures the service functions correctly while still respecting your network policies where possible.

Planning Considerations

Proper planning is crucial for successful subnet delegation. Let me share some hard-learned lessons from production deployments.

Subnet sizing is your first and most critical decision. Unlike regular subnets where you might deploy a handful of VMs, delegated subnets often need more IP addresses than you'd expect. For example, SQL Managed Instance requires a minimum of 32 addresses but might need up to 256 for larger deployments. Always err on the side of too large rather than too small - you cannot resize a subnet with active delegations.

IP address planning becomes complex when you have multiple delegated subnets. I recommend creating a detailed IP allocation plan that accounts for future growth. Remember that some services reserve IP addresses for internal use that won't show up as allocated in your portal. Document these hidden allocations to avoid confusion later.

Service limitations vary significantly between different Azure services. Some services support custom Network Security Groups; others don't. Some work with custom route tables; others override them. Understanding these limitations before implementation saves tremendous troubleshooting time. I maintain a spreadsheet tracking these limitations for each service we use.

Network Security Group rules require special attention. Services inject their own rules, which take precedence. You need to understand these service rules to avoid conflicts. For instance, SQL Managed Instance adds rules for health probes and management traffic that must not be blocked.

Route table considerations are equally important. Some services, like Azure Spring Cloud, don't support forced tunneling. Others, like SQL Managed Instance, support it but require specific routes for management traffic. Plan your routing strategy accordingly.

Cross-region considerations come into play for disaster recovery and high availability. Not all regions support all delegated subnet features. Verify feature availability in your target regions during the planning phase.

Implementation Steps

Let's walk through the actual implementation of subnet delegation. I'll show you how to do this using Azure CLI, as it's reproducible and great for automation.

First, we create a virtual network. The command shown uses az network vnet create with the resource group 'MyResourceGroup', VNet name 'MyVNet', and address prefix '10.0.0.0/16'. This gives us a nice large address space to work with. Always plan your address space carefully - changing it later is painful.

Next, we create the subnet using az network vnet subnet create. Notice the --delegations parameter where we specify 'Microsoft.Sql/managedInstances'. This is the critical part that delegates the subnet. The subnet uses '10.0.1.0/24', giving us 256 addresses. The --resource-group and --vnet-name parameters tie this subnet to our VNet.

The verification step is crucial. The az network vnet subnet show command returns the subnet configuration, and I always pipe it through grep to confirm the delegation is set correctly. You should see the delegation service listed in the output.

Finally, we deploy a resource to the delegated subnet. In this example, we're creating a SQL Managed Instance. The --subnet parameter points to our delegated subnet. Note that this deployment can take 4-6 hours for SQL Managed Instance - it's not a quick process!

One tip I've learned the hard way: always verify your delegation before attempting to deploy resources. If the delegation isn't set correctly, you'll get cryptic error messages that don't immediately point to the delegation as the issue. Save yourself the troubleshooting time and verify first.

Common Delegation Scenarios

Let me share some real-world scenarios where subnet delegation shines. These are patterns I've implemented successfully across multiple enterprises.

The diagram shows four common delegation patterns in a hub-spoke architecture. This is a typical enterprise setup where the hub contains shared services and spokes contain application workloads.

SQL Managed Instance in a dedicated subnet is probably the most common scenario. In this pattern, you create a subnet specifically for your SQL MI deployment. The key here is sizing - I typically use /26 (64 addresses) for development and /24 (256 addresses) for production. This allows for scaling and high availability configurations.

Container Instances with private networking is fantastic for batch processing and microservices. By delegating a subnet to ACI, your containers run with private IPs and can access backend databases without exposing them to the internet. I've used this pattern for ETL jobs that need to process sensitive data.

Web Apps using VNet Integration has become increasingly popular. The newer delegation-based integration is far superior to the old point-to-site method. Your web apps can access backend services using private IPs, and you can even route outbound traffic through your network appliances for inspection.

Azure Spring Cloud enterprise deployment requires careful planning. The service needs multiple subnets - one for the service runtime and another for your applications. Each must be properly sized and delegated. This pattern works well for Java microservices architectures.

Notice in the diagram how each service gets its own delegated subnet. This isn't just a best practice - it's required. You cannot mix services in a delegated subnet. Plan your subnet allocation accordingly.

Network Security with Delegated Subnets

Security in delegated subnets requires a different mindset than traditional VM subnets. Let me explain the nuances and best practices.

The key concept to understand is the hierarchy of rules. When a service delegates a subnet, it injects its own NSG rules that you cannot modify or delete. These service-managed rules ensure the service functions correctly. Your custom rules are evaluated after these service rules.

Looking at the diagram, you can see how SQL Managed Instance injects rules for health probes (from Azure Load Balancer) and management traffic (from specific Azure IP ranges). These rules are priority 100-500, which means they're evaluated before your custom rules that typically start at priority 1000.

For inbound traffic, focus on controlling access between subnets. Since the service manages its own operational traffic, your rules should focus on application-level access. For SQL MI, this means controlling which subnets can access port 1433. For Container Instances, it might be specific application ports.

Outbound traffic control is where you have more flexibility. You can restrict which external services your delegated resources can access. However, be careful not to block required dependencies. For example, SQL Managed Instance needs access to Azure Storage for backups and Azure Active Directory for authentication.

A pattern I've found effective is to create a "default deny" outbound rule at priority 4000, then explicitly allow required traffic at lower priorities. This ensures you're only allowing known-good traffic while leaving room for the service-managed rules.

One gotcha to watch for: some services periodically update their managed rules. Always test NSG changes in non-production first, and monitor for service health issues after any NSG modifications.

Best Practices and Recommendations

After implementing delegated subnets across dozens of enterprises, I've compiled these best practices that will save you time and prevent issues.

First and foremost, document everything. Keep a detailed record of which subnets are delegated to which services, their IP ranges, and any custom configurations. I maintain a simple Excel spreadsheet that tracks subnet delegations, sizing decisions, and any special requirements. This documentation becomes invaluable during troubleshooting or when onboarding new team members.

Always implement changes in non-production environments first. Delegated subnets can have unexpected interactions with your existing network configuration. What works in a simple test environment might fail in your complex production network. Test thoroughly, including failover scenarios for highly available services.

Use consistent naming conventions across your delegated subnets. I prefer names like 'snet-prod-sql-mi-01' or 'snet-dev-aci-01' that clearly indicate the environment, service, and instance. This makes it immediately obvious what each subnet is for when you're troubleshooting at 3 AM.

Plan your IP address space carefully and generously. It's much easier to waste some IP addresses than to resize a subnet later. For production SQL Managed Instances, I always allocate at least a /24. For Container Instances, a /26 is usually sufficient. Document your sizing logic for future reference.

Monitor subnet capacity proactively. Set up Azure Monitor alerts when subnet utilization exceeds 80%. Some services can consume IP addresses in bursts during scaling operations, so you need headroom.

Regular reviews are essential. Azure services evolve rapidly, and new features might require network changes. Schedule quarterly reviews of your delegated subnet configurations to ensure they still meet your needs and incorporate new best practices.

Troubleshooting Delegated Subnets

When things go wrong with delegated subnets, troubleshooting can be challenging. Let me share the most common issues I've encountered and how to resolve them.

The 'Cannot delegate subnet' error usually means the subnet already contains resources or has an incompatible configuration. Check for VMs, network interfaces, or other resources in the subnet. Even deleted resources can sometimes leave artifacts. Use the Azure Resource Graph to query for any resources associated with the subnet.

Service deployment failures are often caused by incorrect subnet sizing or network configuration. SQL Managed Instance, for example, will fail deployment if the subnet doesn't have enough addresses or if certain NSG rules are blocking required traffic. Always check the service-specific requirements in the documentation.

Connectivity issues between resources can be tricky. Remember that service-managed NSG rules might be allowing or blocking traffic in ways you don't expect. Use Network Watcher's IP flow verify and packet capture features to diagnose these issues. The Next Hop feature is particularly useful for understanding routing.

When you see 'Subnet is in use' errors while trying to delete or modify a subnet, it usually means the service hasn't fully cleaned up its resources. Some services take time to remove their components after deletion. Wait 30 minutes and try again. If the issue persists, you might need to contact support.

Performance issues can occur when services in delegated subnets communicate across regions or through network virtual appliances. Use Azure Monitor Connection Monitor to measure latency and packet loss. Sometimes, adjusting your routing configuration can significantly improve performance.

My troubleshooting methodology always starts with checking the basics: Is the delegation configured correctly? Are there any conflicting network policies? Are all required Azure services registered in the subscription? These simple checks resolve 80% of issues.

Advanced Configuration Examples

Let's dive into some advanced configurations that showcase the power and flexibility of delegated subnets. These examples come from real production deployments.

The first example shows forcing traffic through a Network Virtual Appliance (NVA). This is common in enterprises with strict security requirements. The User-Defined Route (UDR) sends all traffic from the delegated subnet to the NVA for inspection. The key is the route for 0.0.0.0/0 pointing to the NVA's IP (10.0.2.4 in this example). However, you must add specific routes for service management traffic to go directly to the internet, bypassing the NVA.

The second configuration demonstrates private endpoints with delegated subnets. This creates a fully private architecture where your SQL Managed Instance accesses Storage and Key Vault through private endpoints. No traffic leaves your VNet boundary. The implementation requires careful DNS configuration to resolve the private endpoint addresses correctly.

Cross-subscription connectivity is increasingly common in large organizations. The example shows how to establish private connectivity between a delegated subnet in one subscription and resources in another. The key is proper VNet peering configuration and ensuring both subscriptions have the necessary resource providers registered.

Each of these patterns requires careful planning and testing. The UDR configuration, in particular, can break service functionality if not done correctly. Always refer to the service-specific documentation for supported routing configurations. Some services don't support forced tunneling at all, while others have specific requirements for management traffic routes.

Cost Optimization

While delegated subnets themselves don't incur charges, the way you design your network architecture around them can significantly impact costs. Let me share some cost optimization strategies.

The table on this slide shows a real-world example comparing costs between traditional and optimized architectures. The key insight is that private connectivity through delegated subnets can eliminate several cost components.

First, consider bandwidth charges. When PaaS services run outside your VNet, data transfer charges apply for all communication. With delegated subnets, traffic within the same VNet is free. For a data-intensive application, this can save thousands of dollars monthly. I've seen cases where SQL Managed Instance in a delegated subnet saved 40% on bandwidth costs compared to Azure SQL Database with service endpoints.

Public IP addresses are another hidden cost. Traditional architectures often require multiple public IPs for various services. With delegated subnets, services use private IPs from your address space, eliminating these charges. At $3-5 per IP per month, this adds up quickly in large deployments.

NAT Gateway usage can be optimized when services run in delegated subnets. Instead of routing all PaaS traffic through NAT Gateways, only specific outbound flows need translation. This reduces both NAT Gateway processing charges and data processing fees.

ExpressRoute optimization is particularly impactful. When services run in delegated subnets, on-premises access doesn't require Microsoft peering or additional ExpressRoute circuits. Everything routes over private peering, simplifying architecture and reducing costs.

The example shows a monthly saving of $850 for a modest deployment. In larger deployments with multiple regions and high data volumes, I've seen savings exceed $10,000 monthly. The key is to analyze your traffic patterns and design accordingly.

Integration with Azure Policies

Governance and compliance are critical in enterprise environments. Azure Policy provides powerful capabilities to manage delegated subnets at scale.

The policy example shown enforces subnet delegation for specific subnet names. This ensures consistency across your environment. When someone creates a subnet named with the pattern 'snet-sqlmi-*', the policy automatically configures the delegation to SQL Managed Instance. This prevents configuration drift and ensures compliance with your network standards.

I've implemented several policy patterns for delegated subnets. One validates that delegated subnets have appropriate NSG rules. Another ensures delegated subnets are sized correctly for their service type. These policies catch configuration errors before they cause deployment failures.

The audit capabilities are particularly valuable. You can create policies that report on delegation status across all subscriptions. This helps identify shadow IT deployments or subnets that should be delegated but aren't. I run these reports monthly as part of our cloud governance reviews.

Remediation tasks can automatically fix non-compliant resources. For example, if someone removes a delegation or modifies a service-managed NSG rule, the remediation task can restore the correct configuration. This self-healing approach reduces operational overhead.

When implementing policies, start with audit mode before switching to enforcement. This lets you understand the impact without breaking existing deployments. Also, use policy exemptions judiciously for legitimate exceptions rather than disabling policies entirely.

Policy initiatives (groups of policies) work well for delegated subnets. Create an initiative that includes all your delegation-related policies, then assign it at the management group level for consistent governance across your Azure estate.

Monitoring and Alerting

Effective monitoring of delegated subnets requires a different approach than traditional infrastructure monitoring. Let me show you how to build comprehensive monitoring for these specialized network resources.

The Azure Monitor configuration shown creates an alert for subnet capacity. This is crucial because running out of IP addresses in a delegated subnet can cause service failures or prevent scaling operations. The metric 'Subnet IP Allocation' triggers when utilization exceeds 80%. I've learned to set this threshold conservatively - by the time you react to a 90% alert, it might be too late.

Network Security Group flow logs are invaluable for delegated subnets. They show you exactly what traffic is flowing between your services. Enable NSG flow logs and send them to Log Analytics. The KQL query 'AzureNetworkAnalytics_CL | where SubnetName contains "delegated"' gives you all flows for your delegated subnets. I use this data to validate that services are communicating as expected and to identify potential security issues.

Service-specific metrics require attention too. Each delegated service exposes metrics through Azure Monitor. For SQL Managed Instance, monitor CPU, storage, and IO metrics. For Container Instances, track container group failures and restarts. Correlate these service metrics with network metrics to get a complete picture.

Creating a dashboard that combines subnet, NSG, and service metrics provides excellent visibility. I typically include subnet utilization, top talkers by flow count, service health metrics, and any active alerts. This single pane of glass helps quickly identify issues during incidents.

Don't forget about cost monitoring. Track data transfer between delegated subnets and other resources. While intra-VNet traffic is free, VNet peering and cross-region traffic incur charges. Unexpected spikes in these metrics often indicate architecture issues or misconfigurations.

Migration Strategies

Migrating existing services to use delegated subnets requires careful planning. I've led several large-scale migrations, and these strategies have proven successful.

For SQL Managed Instance migration from SQL Server, the approach depends on your current setup. If you're running SQL Server on VMs, you can use Azure Database Migration Service with the MI in a delegated subnet as the target. The beauty is that your applications can continue using private connectivity throughout the migration. Plan for the subnet to be in the same VNet as your current VMs or in a peered VNet.

Migrating from public PaaS to delegated implementations is more complex. For App Services, you'll need to enable VNet integration, which requires a delegated subnet. The migration itself involves updating the app configuration, enabling VNet integration, and updating connection strings to use private endpoints. I always do this in a blue-green deployment pattern to minimize downtime.

The gradual migration approach works well for risk-averse organizations. Start by migrating non-production workloads to validate your architecture. Move development environments first, then test, then production. This staged approach helps identify issues early and builds team confidence.

Network architecture adjustments are often necessary. You might need to resize subnets, adjust routing tables, or modify NSG rules. Document all changes and test rollback procedures. I maintain a detailed migration runbook that includes pre-flight checks, migration steps, validation tests, and rollback procedures.

Don't underestimate the importance of updating your operational procedures. Teams need training on managing delegated subnets, troubleshooting connectivity, and understanding the new security model. Include ops team members in the migration planning from day one.

Future Developments

The landscape of Azure delegated subnets is evolving rapidly. Based on Microsoft's roadmap and industry trends, let me share what's coming and how to prepare.

Microsoft has announced expanded service support for subnet delegation. More PaaS services are being redesigned to support this model. Services like Azure Cognitive Services, Azure Synapse Analytics, and Azure Data Factory are likely candidates for future delegation support. This trend toward private connectivity reflects enterprise demands for better network control.

Enhanced automation capabilities are in development. Expect to see better ARM template support, Terraform providers with full feature parity, and improved Bicep modules for delegated subnet deployment. Microsoft is also working on making the delegation process more intelligent, with automatic sizing recommendations based on workload patterns.

Improved monitoring and diagnostics tools specifically for delegated subnets are coming. The Network Watcher team has previewed features that provide better visibility into service-injected routes and NSG rules. This will make troubleshooting much easier.

Integration with Azure Arc is particularly exciting. This will allow hybrid services to leverage delegation concepts, potentially extending private connectivity models to on-premises and other cloud environments. Imagine Kubernetes clusters anywhere using Azure networking constructs consistently.

To prepare for these developments, I recommend standardizing your delegation patterns now. Use consistent naming, document thoroughly, and automate where possible. Organizations with mature delegation implementations will be best positioned to adopt new capabilities as they're released. Also, participate in preview programs to provide feedback and influence feature development.

Real-World Case Study

Let me share a detailed case study from a financial services client that illustrates the power of delegated subnets in solving complex networking challenges.

The company, a major insurance provider, needed to modernize their claims processing system while maintaining strict regulatory compliance. Their existing architecture used SQL Server VMs and web servers, all communicating over ExpressRoute to on-premises systems. The challenge was moving to PaaS services without compromising security or changing their on-premises applications.

We designed a solution using SQL Managed Instance in a delegated subnet for the database tier and App Service with VNet Integration for the web tier. The delegated subnets were placed in their existing hub VNet, allowing seamless communication with on-premises systems over existing ExpressRoute circuits.

The implementation revealed several interesting challenges. First, sizing the SQL MI subnet required careful analysis of their growth projections. We settled on a /24 after modeling five-year growth scenarios. Second, their existing NSG rules conflicted with SQL MI requirements. We had to redesign their security policies to accommodate service-managed rules while maintaining compliance.

The results exceeded expectations. Query performance improved by 60% due to SQL MI's optimizations. Operational overhead dropped dramatically - no more patching weekends! Most importantly, the solution passed security audit with flying colors because all traffic remained private. The monthly cost savings of $12,000 came from eliminated SQL licenses, reduced VM costs, and lower operational overhead.

Key lessons learned: involve security and compliance teams early, thoroughly test NSG rule interactions, and plan subnet sizing for long-term growth. This project became the template for modernizing their other applications.

Common Pitfalls to Avoid

Let me share the most common mistakes I see organizations make with delegated subnets, so you can avoid learning these lessons the hard way.

Incorrect subnet sizing is the number one issue. Teams often size subnets based on visible resource needs without accounting for service overhead. SQL Managed Instance, for instance, uses many addresses internally that don't appear as NICs in your portal. I've seen production deployments fail because a /28 subnet ran out of addresses during a scaling operation. Always follow Microsoft's sizing guidance and add buffer.

Network policy conflicts cause subtle but serious issues. A client once had a policy that forced all traffic through their firewall, including Azure management traffic. Their SQL Managed Instance would deploy successfully but fail health checks randomly. After weeks of troubleshooting, we discovered their UDR was blocking Azure Load Balancer probes. Always validate that service management traffic can flow correctly.

Incomplete migration planning leads to extended downtime and failed cutovers. Teams often focus on the application migration but forget about DNS updates, connection string changes, and firewall rule modifications. Create a comprehensive checklist that includes every system that touches your service, including monitoring, backup, and automation tools.

Missing dependencies become apparent only during failures. One organization discovered during a disaster recovery test that their delegated SQL MI couldn't access backup storage in the DR region due to missing private endpoints. Map all service dependencies and ensure they're accessible from your delegated subnets in all scenarios.

Overlooking service limits has bitten many teams. Did you know there's a limit on the number of delegated subnets per VNet? Or that some services have regional limitations on delegation features? Always check current service limits and quotas during planning.

Summary and Key Takeaways

As we wrap up this comprehensive look at Azure delegated subnets, let's recap the key points that will help you succeed with this powerful feature.

Delegated subnets represent a fundamental shift in how Azure PaaS services integrate with your network. By giving services dedicated space within your VNet, you get the best of both worlds - managed services with private network control. This isn't just a technical feature; it's an enabler for digital transformation in security-conscious organizations.

The benefits we've covered - network isolation, private connectivity, simplified security, and enhanced compliance - solve real business problems. I've seen delegated subnets unblock cloud adoption in organizations that previously couldn't use PaaS services due to security constraints.

Proper planning cannot be overstated. Size your subnets appropriately, understand service limitations, plan your IP address space, and document everything. The time invested in planning pays dividends in smooth deployments and easy troubleshooting.

Remember that delegated subnets are part of a larger cloud strategy. They work best when combined with hub-spoke architectures, private endpoints, and well-designed network security. Think holistically about your network architecture.

As Azure continues to evolve, delegated subnets will become even more important. Stay current with new service support and features. The investment you make in understanding and implementing delegated subnets today will serve you well as more services adopt this model.

Thank you for your attendance. Please consider subscribing to the channel.

Azure Delegated Subnets

Mastering Private PaaS Connectivity

graph TB subgraph "Azure Virtual Network" subgraph "Regular Subnets" VM1[Virtual Machine] VM2[Virtual Machine] end subgraph "Delegated Subnet" PaaS[PaaS Service] end end VM1 -.->|Private IP| PaaS VM2 -.->|Private IP| PaaS PaaS -.->|Managed by Azure| Azure[Azure Service Provider]

What You'll Learn

  • Core concepts of subnet delegation
  • Supported Azure services
  • Implementation best practices
  • Security and compliance benefits
  • Real-world migration strategies

What Are Delegated Subnets?

graph TB subgraph "Virtual Network 10.0.0.0/16" subgraph "Regular Subnet 10.0.1.0/24" VM[VMs/Resources] end subgraph "Delegated to SQL MI 10.0.2.0/24" SQLMI[SQL Managed Instance] end subgraph "Delegated to ACI 10.0.3.0/24" ACI[Container Instances] end end

Key Characteristics

  • Exclusive Delegation: One subnet = One service type
  • Service-Managed: Azure service controls certain network aspects
  • Private IPs: Resources get IPs from your address space
  • Integrated Security: NSGs and UDRs apply (with limitations)

Key Benefits

graph LR subgraph Benefits A[Network Isolation] B[Private Connectivity] C[Simplified Security] D[Enhanced Compliance] E[On-Premises Integration] end A -->|No Public IPs| F[Reduced Attack Surface] B -->|VNet Native| G[Low Latency] C -->|NSG Rules| H[Consistent Policies] D -->|Data Sovereignty| I[Regulatory Compliance] E -->|ExpressRoute| J[Hybrid Cloud]
Traditional PaaS With Delegated Subnets
Public IP connectivity Private IP only
Complex firewall rules Standard NSG policies
Limited VNet integration Full VNet membership

Services Supporting Delegation

Azure SQL MI

Microsoft.Sql/managedInstances

Container Instances

Microsoft.ContainerInstance/containerGroups

App Service

Microsoft.Web/serverFarms

Azure NetApp Files

Microsoft.NetApp/volumes

Azure Spring Cloud

Microsoft.AppPlatform/Spring

API Management

Microsoft.ApiManagement/service

Important Notes

  • Not all services support all delegation features
  • Check regional availability
  • Review service-specific requirements

How Delegation Works

sequenceDiagram participant User participant ARM as Azure Resource Manager participant VNet participant Service as Service Provider User->>ARM: Create subnet with delegation ARM->>VNet: Configure delegation VNet->>Service: Register delegation Service->>VNet: Inject service rules Service->>VNet: Reserve IP addresses User->>Service: Deploy resource Service->>VNet: Allocate IPs Service-->>User: Resource deployed

Behind the Scenes

  • Service provider registers with the subnet
  • Automatic NSG rules are injected
  • IP address management is handled by the service
  • Route tables may be modified for service operation

Planning Considerations

Consideration Recommendation
Subnet Sizing Follow service guidelines + 50% buffer
IP Planning Document hidden service allocations
NSG Rules Understand service-injected rules
Routing Verify forced tunneling support
Region Support Confirm feature availability
graph TB A[Assess Requirements] --> B[Size Subnets] B --> C[Plan IP Space] C --> D[Design Security] D --> E[Validate Routing] E --> F[Test in Dev] F --> G[Deploy to Prod]

Implementation Steps

# Create Virtual Network az network vnet create \ --resource-group MyResourceGroup \ --name MyVNet \ --address-prefix 10.0.0.0/16 # Create Delegated Subnet az network vnet subnet create \ --resource-group MyResourceGroup \ --vnet-name MyVNet \ --name MyDelegatedSubnet \ --address-prefix 10.0.1.0/24 \ --delegations Microsoft.Sql/managedInstances # Verify Delegation az network vnet subnet show \ --resource-group MyResourceGroup \ --vnet-name MyVNet \ --name MyDelegatedSubnet \ --query delegations # Deploy Resource (Example: SQL MI) az sql mi create \ --resource-group MyResourceGroup \ --name MyManagedInstance \ --subnet MyDelegatedSubnet \ --vnet-name MyVNet

Common Delegation Scenarios

graph TB subgraph "Hub VNet" FW[Azure Firewall] GW[VPN/ExpressRoute Gateway] end subgraph "Spoke 1 - Data Tier" subgraph "Delegated: SQL MI" DB[(SQL Managed Instance)] end end subgraph "Spoke 2 - App Tier" subgraph "Delegated: App Service" WEB[Web Apps] end subgraph "Delegated: ACI" BATCH[Batch Processing] end end FW -.-> DB FW -.-> WEB FW -.-> BATCH WEB --> DB BATCH --> DB GW -.-> FW
  • SQL MI in dedicated subnet: High-performance database tier
  • Container Instances: Serverless compute with private IPs
  • Web Apps with VNet Integration: Secure web tier
  • Azure Spring Cloud: Microservices platform

Network Security

graph TB subgraph "NSG Rule Hierarchy" A[Service-Managed Rules
Priority: 100-500] B[Your Custom Rules
Priority: 1000+] end A --> C{Traffic Evaluation} B --> C C --> D[Allow/Deny Decision] subgraph "Example: SQL MI Rules" E[Health Probes - Pri: 100] F[Management - Pri: 200] G[Your App Access - Pri: 1000] end
# Example NSG Rules for SQL MI Inbound: 100: Allow AzureLoadBalancer to Any (Port 11000-11999) 200: Allow SqlManagement to Any (Port 1433-1440) 1000: Allow AppSubnet to Any (Port 1433) 4000: Deny Any to Any Outbound: 100: Allow Any to AzureCloud (Port 443) 200: Allow Any to Storage (Port 443) 1000: Allow Any to AppSubnet (Any) 4000: Deny Any to Any

Best Practices

Documentation

  • Maintain delegation inventory
  • Document sizing decisions
  • Track service requirements
  • Record custom configurations

Testing

  • Always test in non-production
  • Validate failover scenarios
  • Test scaling operations
  • Verify backup/restore

Operations

  • Use consistent naming
  • Monitor subnet capacity
  • Set up proactive alerts
  • Regular review cycles

Architecture

  • Plan IP space generously
  • Consider DR requirements
  • Design for growth
  • Standardize patterns

Troubleshooting Guide

Issue Common Causes Resolution
Cannot delegate subnet Existing resources, wrong size Clear subnet, verify requirements
Service deployment fails NSG blocking, insufficient IPs Check service rules, resize subnet
Connectivity issues Routing problems, NSG rules Use Network Watcher tools
Cannot delete subnet Service cleanup pending Wait 30 mins, check resources
# Diagnostic Commands # Check subnet delegation az network vnet subnet show -g RG -n subnet --vnet-name vnet --query delegations # List all resources in subnet az network vnet subnet list-available-ips -g RG -n subnet --vnet-name vnet # Check NSG flow logs az network watcher flow-log show -g RG -n MyNSG

Advanced Configurations

# Force traffic through NVA az network route-table route create \ --resource-group MyRG \ --route-table-name MyRouteTable \ --name ForceToNVA \ --address-prefix 0.0.0.0/0 \ --next-hop-type VirtualAppliance \ --next-hop-ip-address 10.0.2.4 # Exception for service management az network route-table route create \ --resource-group MyRG \ --route-table-name MyRouteTable \ --name AllowAzureManagement \ --address-prefix AzureCloud.EastUS \ --next-hop-type Internet

Private Endpoints with Delegated Subnets

graph LR A[SQL MI
Delegated Subnet] --> B[Private Endpoint
Storage] A --> C[Private Endpoint
Key Vault] B --> D[Azure Storage] C --> E[Azure Key Vault]

Cost Optimization

Component Traditional With Delegation Monthly Savings
Bandwidth (10TB) $500 $0 $500
Public IPs (5) $25 $0 $25
NAT Gateway Processing $200 $50 $150
ExpressRoute (Microsoft Peering) $175 $0 $175
Total $900 $50 $850

Key Savings Areas

  • Eliminate data egress charges for intra-VNet traffic
  • Remove need for public IP addresses
  • Reduce NAT Gateway usage
  • Simplify ExpressRoute architecture

Azure Policy Integration

{ "properties": { "displayName": "Enforce subnet delegation for SQL MI", "policyType": "Custom", "mode": "All", "parameters": {}, "policyRule": { "if": { "allOf": [ { "field": "type", "equals": "Microsoft.Network/virtualNetworks/subnets" }, { "field": "name", "like": "snet-sqlmi-*" } ] }, "then": { "effect": "deployIfNotExists", "details": { "type": "Microsoft.Network/virtualNetworks/subnets", "existenceCondition": { "field": "Microsoft.Network/virtualNetworks/subnets/delegations[*].serviceName", "equals": "Microsoft.Sql/managedInstances" }, "deployment": { "properties": { "mode": "incremental", "template": { // Template to add delegation } } } } } } } }

Monitoring and Alerting

# Create subnet capacity alert az monitor metrics alert create \ --name subnet-capacity-alert \ --resource-group MyRG \ --scopes /subscriptions/.../subnets/MyDelegatedSubnet \ --condition "avg Percentage Used > 80" \ --description "Delegated subnet approaching capacity" # Query NSG flow logs AzureNetworkAnalytics_CL | where SubnetName_s contains "delegated" | summarize TotalFlows = count() by SubnetName_s, NSGRule_s | order by TotalFlows desc

Key Metrics to Monitor

  • Subnet IP allocation percentage
  • NSG flow counts and denies
  • Service-specific health metrics
  • Data transfer volumes for cost tracking

Migration Strategies

graph TB subgraph "Current State" A[SQL on VMs] B[Public PaaS] end subgraph "Migration Phase" C[Deploy Delegated Subnet] D[Deploy New Services] E[Sync Data] F[Test Connectivity] end subgraph "Target State" G[SQL MI in Delegated Subnet] H[Private PaaS Services] end A --> C B --> C C --> D D --> E E --> F F --> G F --> H
  • Phase 1: Deploy delegated infrastructure
  • Phase 2: Migrate non-production workloads
  • Phase 3: Validate performance and security
  • Phase 4: Migrate production with rollback plan

Future Developments

Coming Soon

  • More services supporting delegation
  • Enhanced automation capabilities
  • Better monitoring tools
  • Simplified troubleshooting

Under Development

  • Cross-region delegation
  • Azure Arc integration
  • Advanced routing capabilities
  • Multi-service delegation

Prepare for the Future

  • Standardize delegation patterns now
  • Document current implementations thoroughly
  • Participate in preview programs
  • Build automation for easy adoption

Real-World Case Study

Financial Services Cloud Migration

graph TB subgraph "Before" A[SQL VMs
4x E32s_v3] B[Web VMs
8x D4s_v3] C[On-Premises
Legacy Apps] end subgraph "After" D[SQL MI
Business Critical] E[App Service
Premium v3] F[Same On-Prem
Apps] end A -.->|Migration| D B -.->|Migration| E C -->|ExpressRoute| F D <-->|Private| E F <-->|Private| D
Metric Before After Improvement
Query Performance Baseline 60% faster +60%
Monthly Cost $28,000 $16,000 -43%
Maintenance Hours 40/month 5/month -87%

Common Pitfalls

⚠️ Top 5 Mistakes to Avoid

  1. Incorrect Subnet Sizing
    • Not accounting for service overhead
    • Solution: Follow sizing guides + 50% buffer
  2. Network Policy Conflicts
    • UDRs blocking management traffic
    • Solution: Validate service requirements
  3. Incomplete Migration Planning
    • Missing DNS, firewall, connection updates
    • Solution: Comprehensive checklist
  4. Missing Dependencies
    • Storage, Key Vault access issues
    • Solution: Map all service dependencies
  5. Overlooking Service Limits
    • Hitting delegation quotas
    • Solution: Check limits during planning

Summary and Key Takeaways

🎯 Essential Points

  • Delegated subnets enable private PaaS: True VNet integration
  • Security and compliance benefits: Private IPs, NSG control
  • Careful planning is crucial: Size appropriately, understand limits
  • Growing ecosystem: More services adding support
  • Cost optimization opportunities: Reduce bandwidth and IP costs
graph LR A[Plan] --> B[Implement] B --> C[Monitor] C --> D[Optimize] D --> A

Next Steps

  • Assess your current PaaS services for delegation opportunities
  • Start with non-production environments
  • Build expertise with common services (SQL MI, App Service)
  • Implement monitoring and governance early
1 / 20