【Azure云】服务端点(Service Endpoint)和私有链接(Private Link)有什么区别?
很长一段时间以来,如果您在许多Azure服务上使用多租户、PaaS版本,那么您必须通过internet访问它们,并且无法限制对您的资源的访问。这种限制主要是由于对多租户服务进行这种限制的复杂性。目前,获得这种限制的唯一方法是考虑使用单租户解决方案,如应用服务环境(ASE)或在VM中自己运行服务,而不是使用PaaS。
这种公共访问是许多人关心的问题,因此微软实现了允许您限制对这些多租户服务的访问的新服务。今天,我们有两个表面上看起来非常相似的解决方案:服务端点和私有链接。这两个服务的设计都允许您限制谁连接到您的服务以及如何连接。因此,要知道应该使用哪种服务以及它的好处是什么可能会让人感到困惑。在本文中,我们将研究这些服务,并尝试使决策更加清晰。
注意,在本文中,我们只讨论公开多租户PaaS服务的方法,而没有讨论“私有链接服务”( “Private Link Service”),它允许服务提供者通过私有链接向客户端公开服务。
服务端点(Service EndPoint)
服务端点是引入的第一个允许锁定多租户服务的服务。服务端点允许您将对PaaS资源的访问限制为来自Azure虚拟网络的流量。对于服务端点,PaaS服务仍然独立于您的vNet,流量离开虚拟网络来访问PaaS服务。然而,PaaS服务被配置为能够识别来自虚拟网络的流量并允许这样做,而不需要配置vNet上的公共IP来允许过滤。
服务端点通过启用虚拟网络上的子网来支持服务端点来工作。完成此操作后,可以将PaaS资源配置为只接受来自这些子网的流量。没有要求做任何IP过滤或NAT转换;告诉PaaS资源从哪个vNet和子网允许流量。当服务端点被启用时,PaaS资源将看到来自vNets私有IP的流量,而不是它的公共IP。
使用服务端点的另一个优势是流量被最优地路由到Azure资源。即使您的vNet上有UDRs来将internet流量路由回本地或通过防火墙设备,使用服务端点也意味着流量被直接发送到Azure资源。
Generally available
- Azure Storage (Microsoft.Storage): Generally available in all Azure regions.
- Azure SQL Database (Microsoft.Sql): Generally available in all Azure regions.
- Azure Synapse Analytics (Microsoft.Sql): Generally available in all Azure regions.
- Azure Database for PostgreSQL server (Microsoft.Sql): Generally available in Azure regions where database service is available.
- Azure Database for MySQL server (Microsoft.Sql): Generally available in Azure regions where database service is available.
- Azure Database for MariaDB (Microsoft.Sql): Generally available in Azure regions where database service is available.
- Azure Cosmos DB (Microsoft.AzureCosmosDB): Generally available in all Azure regions.
- Azure Key Vault (Microsoft.KeyVault): Generally available in all Azure regions.
- Azure Service Bus (Microsoft.ServiceBus): Generally available in all Azure regions.
- Azure Event Hubs (Microsoft.EventHub): Generally available in all Azure regions.
- Azure Data Lake Store Gen 1 (Microsoft.AzureActiveDirectory): Generally available in all Azure regions where ADLS Gen1 is available.
- Azure App Service (Microsoft.Web): Generally available in all Azure regions where App service is available.
- Azure Cognitive Services (Microsoft.CognitiveServices): Generally available in all Azure regions where Cognitive services are available.
Public Preview
- Azure Container Registry (Microsoft.ContainerRegistry): Preview available in limited Azure regions where Azure Container Registry is available.
For the most up-to-date notifications, check the Azure Virtual Network updates page.
服务端点确实有一些限制或缺点。
- 首先,关键是要记住,到服务端点的流量仍然在离开虚拟网络,Azure PaaS资源仍然在其公共地址上被访问。
- 通过VPN或Express路由在本地发起的流量不能使用服务端点,只能用于来自Azure虚拟网络的流量。
- 如果您希望允许您的本地资源访问,您还需要将它们的公共IP列入白名单。
更多信息:https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-…。
私人连接(Private Link)
私有链接是比服务端点更新的解决方案,大约在一年前引入。私有链接和服务端点之间的关键区别在于,使用私有链接,您将多租户PaaS资源注入虚拟网络。与服务端点,流量仍然离开你的vNet和击中PaaS资源的公共端点,与私有链接的PaaS资源坐在你的vNet和得到你的vNet上的私有IP。当您向PaaS资源发送流量时,它并不离开虚拟网络。
与Private Link的另一个关键区别是,当启用时,您将授予对虚拟网络中特定PaaS资源的访问权。这意味着您可以控制到PaaS资源的出口。例如,如果您愿意,您可以使用NSG来阻止对所有Azure SQL数据库的访问,然后使用Private Link来只授予对您特定的Azure SQL服务器的访问权。
与服务端点不同,私有链接允许通过VPN或高速路由从您的本地网络上的资源访问,以及从窥视网络访问。您还可以连接到跨地区的资源。
可用性
The following table lists the Private Link services and the regions where they're available.
Supported services | Available regions | Additional considerations | Status | |
---|---|---|---|---|
Private Link services behind standard Azure Load Balancer | All public regions All Government regions All China regions |
Supported on Standard Load Balancer | GA Learn how to create a private link service. |
|
Azure Blob storage (including Data Lake Storage Gen2) | All public regions All Government regions |
Supported on Account Kind General Purpose V2 | GA Learn how to create a private endpoint for blob storage. |
|
Azure Files | All public regions All Government regions |
GA Learn how to create Azure Files network endpoints. |
||
Azure File Sync | All public regions | GA Learn how to create Azure Files network endpoints. |
||
Azure Queue storage | All public regions All Government regions |
Supported on Account Kind General Purpose V2 | GA Learn how to create a private endpoint for queue storage. |
|
Azure Table storage | All public regions All Government regions |
Supported on Account Kind General Purpose V2 | GA Learn how to create a private endpoint for table storage. |
|
Azure SQL Database | All public regions All Government regions All China regions |
Supported for Proxy connection policy | GA Learn how to create a private endpoint for Azure SQL |
|
Azure Synapse Analytics | All public regions All Government regions |
Supported for Proxy connection policy | GA Learn how to create a private endpoint for Azure Synapse Analytics. |
|
Azure Cosmos DB | All public regions All Government regions All China regions |
GA Learn how to create a private endpoint for Cosmos DB. |
||
Azure Database for PostgreSQL - Single server | All public regions All Government regions All China regions |
Supported for General Purpose and Memory Optimized pricing tiers | GA Learn how to create a private endpoint for Azure Database for PostgreSQL. |
|
Azure Database for MySQL | All public regions All Government regions All China regions |
GA Learn how to create a private endpoint for Azure Database for MySQL. |
||
Azure Database for MariaDB | All public regions All Government regions All China regions |
GA Learn how to create a private endpoint for Azure Database for MariaDB. |
||
Azure Key Vault | All public regions All Government regions |
GA Learn how to create a private endpoint for Azure Key Vault. |
||
Azure Kubernetes Service - Kubernetes API | All public regions | GA Learn how to create a private endpoint for Azure Kubernetes Service. |
||
Azure Search | All public regions All Government regions |
Supported with service in Private Mode | GA Learn how to create a private endpoint for Azure Search. |
|
Azure Container Registry | All public regions All Government regions |
Supported with premium tier of container registry. Select for tiers | GA Learn how to create a private endpoint for Azure Container Registry. |
|
Azure App Configuration | All public regions | Preview Learn how to create a private endpoint for Azure App Configuration |
||
Azure Backup | All public regions All Government regions |
GA Learn how to create a private endpoint for Azure Backup. |
||
Azure Event Hub | All public regions All Government regions |
GA Learn how to create a private endpoint for Azure Event Hub. |
||
Azure Service Bus | All public region All Government regions |
Supported with premium tier of Azure Service Bus. Select for tiers | GA Learn how to create a private endpoint for Azure Service Bus. |
|
Azure Relay | All public regions | Preview Learn how to create a private endpoint for Azure Relay. |
||
Azure Event Grid | All public regions All Government regions |
GA Learn how to create a private endpoint for Azure Event Grid. |
||
Azure Web Apps | All public regions | Supported with PremiumV2, PremiumV3, or Function Premium plan | GA Learn how to create a private endpoint for Azure Web Apps. |
|
Azure Machine Learning | All public regions | GA Learn how to create a private endpoint for Azure Machine Learning. |
||
Azure Automation | All public regions | Preview Learn how to create a private endpoint for Azure Automation. |
||
Azure IoT Hub | All public regions | GA Learn how to create a private endpoint for Azure IoT Hub. |
||
Azure SignalR | EAST US, SOUTH CENTRAL US, WEST US 2, All China regions |
Preview Learn how to create a private endpoint for Azure SignalR. |
||
Azure Monitor (Log Analytics & Application Insights) |
All public regions | GA Learn how to create a private endpoint for Azure Monitor. |
||
Azure Batch | All public regions except: Germany CENTRAL, Germany NORTHEAST All Government regions |
GA Learn how to create a private endpoint for Azure Batch. |
||
Azure Data Factory | All public regions All Government regions All China regions |
Credentials need to be stored in an Azure key vault | GA Learn how to create a private endpoint for Azure Data Factory. |
|
Azure Managed Disks | All public regions All Government regions All China regions |
Click here for known limitations | GA Learn how to create a private endpoint for Azure Managed Disks. |
For the most up-to-date notifications, check the Azure Private Link updates page.
私有链接的一个缺点是,为了支持使用相同名称解析PaaS资源,您需要实现DNS来解析特定资源的私有链接区域。您可以通过集成Azure私有DNS来设置这个功能,但如果您的DNS服务已经在运行,或者您不想在虚拟网络中使用Azure私有DNS,那么这可能会有问题。
更多信息:https://docs.microsoft.com/en-us/azure/private-link/private-link-overvi…。
选择哪一个?
现在,您已经对每个服务进行了快速介绍,问题归结为应该使用哪个服务?答案将基于几个因素。
首先,查看您想要访问的资源,并查看它所支持的服务。有些服务将只受其中一种或另一种支持,因此这将为您选择。
假设您可以为您的服务使用任何一个选项,那么决定可能会归结为复杂性。
服务端点比私有链接更直接、更容易设置。您可以通过在门户中单击几次来启用服务端点,并且不需要任何其他服务。然而,私有链接需要您实现DNS更改,并可能使用Azure私有DNS,它还需要决定服务将连接到您的虚拟网络的何处。因此,如果您需要对PaaS服务快速进行额外的访问限制,或者没有权利或知识对DNS进行更改,那么服务端点可能是最好的选择。
除了复杂性之外,私有链接在几乎所有其他方面都优于服务端点。如果您可以设置这个,并且您的服务支持它,那么我建议您在服务端点上使用私有链接。特别是与私人链接,你可以:
- 加入你的PaaS资源到你的vNet,并给它一个私有IP
- 确保流量保持在虚拟网络中
- 将出口限制到特定的PaaS服务,并防止数据泄漏
- 支持从现场和窥视网络访问
- 连接到跨区域的资源,甚至Azure的广告租户
对于大多数关注PaaS资源的安全性和访问限制的人来说,Private Link将是更好的选择。在这一点上,我很惊讶地看到支持服务端点的资源列表超出了现有可用资源的范围,大多数PaaS资源希望发布私有链接产品。
原文:https://samcogan.com/service-endpoints-and-private-link-whats-the-difference/
本文:http://jiagoushi.pro/node/1379
讨论:请加入知识星球【首席架构师圈】或者小号【jiagoushi_pro】或者QQ群【11107777】
- 427 次浏览