-
Notifications
You must be signed in to change notification settings - Fork 814
Add AzureServiceTags with common Azure service tags for NSG rules #14452
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
+183
−11
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Aspire.Hosting.Azure; | ||
|
|
||
| /// <summary> | ||
| /// Provides well-known Azure service tags that can be used as source or destination address prefixes | ||
| /// in network security group rules. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// 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. | ||
| /// </para> | ||
| /// <para> | ||
| /// These tags can be used with the <c>from</c> and <c>to</c> parameters of methods such as | ||
| /// <see cref="AzureVirtualNetworkExtensions.AllowInbound"/>, <see cref="AzureVirtualNetworkExtensions.DenyInbound"/>, | ||
| /// <see cref="AzureVirtualNetworkExtensions.AllowOutbound"/>, <see cref="AzureVirtualNetworkExtensions.DenyOutbound"/>, | ||
| /// or with the <see cref="AzureSecurityRule.SourceAddressPrefix"/> and <see cref="AzureSecurityRule.DestinationAddressPrefix"/> properties. | ||
| /// </para> | ||
| /// </remarks> | ||
| /// <example> | ||
| /// Use service tags when configuring network security rules: | ||
| /// <code> | ||
| /// var subnet = vnet.AddSubnet("web", "10.0.1.0/24") | ||
| /// .AllowInbound(port: "443", from: AzureServiceTags.AzureLoadBalancer, protocol: SecurityRuleProtocol.Tcp) | ||
| /// .DenyInbound(from: AzureServiceTags.Internet); | ||
| /// </code> | ||
| /// </example> | ||
| public static class AzureServiceTags | ||
| { | ||
| /// <summary> | ||
| /// Represents the Internet address space, including all publicly routable IP addresses. | ||
| /// </summary> | ||
| public const string Internet = nameof(Internet); | ||
|
|
||
| /// <summary> | ||
| /// Represents the address space for the virtual network, including all connected address spaces, | ||
| /// all connected on-premises address spaces, and peered virtual networks. | ||
| /// </summary> | ||
| public const string VirtualNetwork = nameof(VirtualNetwork); | ||
|
|
||
| /// <summary> | ||
| /// Represents the Azure infrastructure load balancer. This tag is commonly used to allow | ||
| /// health probe traffic from Azure. | ||
| /// </summary> | ||
| public const string AzureLoadBalancer = nameof(AzureLoadBalancer); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Traffic Manager probe IP addresses. | ||
| /// </summary> | ||
| public const string AzureTrafficManager = nameof(AzureTrafficManager); | ||
|
|
||
| /// <summary> | ||
| /// Represents the Azure Storage service. This tag does not include specific Storage accounts; | ||
| /// it covers all Azure Storage IP addresses. | ||
| /// </summary> | ||
| public const string Storage = nameof(Storage); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure SQL Database, Azure Database for MySQL, Azure Database for PostgreSQL, | ||
| /// Azure Database for MariaDB, and Azure Synapse Analytics. | ||
| /// </summary> | ||
| public const string Sql = nameof(Sql); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Cosmos DB service addresses. | ||
| /// </summary> | ||
| public const string AzureCosmosDB = nameof(AzureCosmosDB); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Key Vault service addresses. | ||
| /// </summary> | ||
| public const string AzureKeyVault = nameof(AzureKeyVault); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Event Hubs service addresses. | ||
| /// </summary> | ||
| public const string EventHub = nameof(EventHub); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Service Bus service addresses. | ||
| /// </summary> | ||
| public const string ServiceBus = nameof(ServiceBus); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Container Registry service addresses. | ||
| /// </summary> | ||
| public const string AzureContainerRegistry = nameof(AzureContainerRegistry); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure App Service and Azure Functions service addresses. | ||
| /// </summary> | ||
| public const string AppService = nameof(AppService); | ||
|
|
||
| /// <summary> | ||
| /// Represents Microsoft Entra ID (formerly Azure Active Directory) service addresses. | ||
| /// </summary> | ||
| public const string AzureActiveDirectory = nameof(AzureActiveDirectory); | ||
|
|
||
| /// <summary> | ||
| /// Represents Azure Monitor service addresses, including Log Analytics, Application Insights, | ||
| /// and Azure Monitor metrics. | ||
| /// </summary> | ||
| public const string AzureMonitor = nameof(AzureMonitor); | ||
|
|
||
| /// <summary> | ||
| /// Represents the Gateway Manager service, used for VPN Gateway and Application Gateway management traffic. | ||
| /// </summary> | ||
| public const string GatewayManager = nameof(GatewayManager); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.