Watch Aspire live streamsDocsTry Aspire

AzureServiceTags

Classstaticnet10.0
📦 Aspire.Hosting.Azure.Network v13.6.0
Provides well-known Azure service tags that can be used as source or destination address prefixes in network security group rules.
namespace Aspire.Hosting.Azure;
public static class AzureServiceTags
{
// ...
}

Service tags represent a group of IP address prefixes from a given Azure service. Microsoft manages the address prefixes encompassed by each tag and automatically updates them as addresses change.

These tags can be used with the from and to parameters of methods such as AzureVirtualNetworkExtensions.AllowInbound, AzureVirtualNetworkExtensions.DenyInbound, AzureVirtualNetworkExtensions.AllowOutbound, AzureVirtualNetworkExtensions.DenyOutbound, or with the AzureSecurityRule.SourceAddressPrefix and AzureSecurityRule.DestinationAddressPrefix properties.

View all fields

Use service tags when configuring network security rules:

var subnet = vnet.AddSubnet("web", "10.0.1.0/24")
.AllowInbound(port: "443", from: AzureServiceTags.AzureLoadBalancer, protocol: SecurityRuleProtocol.Tcp)
.DenyInbound(from: AzureServiceTags.Internet);