Skip to content
Docs Try Aspire

AzureServiceTags

Class static net8.0
📦 Aspire.Hosting.Azure.Network v13.2.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.

AppServicestatic
string
Represents Azure App Service and Azure Functions service addresses.
AzureActiveDirectorystatic
string
Represents Microsoft Entra ID (formerly Azure Active Directory) service addresses.
AzureContainerRegistrystatic
string
Represents Azure Container Registry service addresses.
AzureCosmosDBstatic
string
Represents Azure Cosmos DB service addresses.
AzureKeyVaultstatic
string
Represents Azure Key Vault service addresses.
AzureLoadBalancerstatic
string
Represents the Azure infrastructure load balancer. This tag is commonly used to allow health probe traffic from Azure.
AzureMonitorstatic
string
Represents Azure Monitor service addresses, including Log Analytics, Application Insights, and Azure Monitor metrics.
AzureTrafficManagerstatic
string
Represents Azure Traffic Manager probe IP addresses.
EventHubstatic
string
Represents Azure Event Hubs service addresses.
GatewayManagerstatic
string
Represents the Gateway Manager service, used for VPN Gateway and Application Gateway management traffic.
Internetstatic
string
Represents the Internet address space, including all publicly routable IP addresses.
ServiceBusstatic
string
Represents Azure Service Bus service addresses.
Sqlstatic
string
Represents Azure SQL Database, Azure Database for MySQL, Azure Database for PostgreSQL, Azure Database for MariaDB, and Azure Synapse Analytics.
Storagestatic
string
Represents the Azure Storage service. This tag does not include specific Storage accounts; it covers all Azure Storage IP addresses.
VirtualNetworkstatic
string
Represents the address space for the virtual network, including all connected address spaces, all connected on-premises address spaces, and peered virtual networks.
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);