专用终结点允许您在虚拟网络中通过专用 IP 地址连接到弹性 SAN 卷组。 使用专用终结点时,虚拟网络与弹性 SAN 之间的流量完全保留在 Azure 的专用主干上,而无需遍历公共 Internet。 配置并批准专用终结点后,会自动向其所在的子网授予访问权限。 此配置提供强大的网络隔离,非常适合生产或安全敏感的工作负荷。
本文介绍如何配置您的弹性 SAN 卷组,以便使用专用终结点。
先决条件
配置专用终结点连接涉及两个步骤:
必须具有 弹性 SAN 卷组所有者 角色才能为弹性 SAN 卷组创建专用终结点。 若要批准新的专用终结点连接,必须具有对 Azure 资源提供程序操作Microsoft.ElasticSan/elasticSans/PrivateEndpointConnectionsApproval/action
的权限。 此操作的权限包含在弹性 SAN 网络管理员角色中,但也可以通过自定义 Azure 角色授予。
如果从具有创建和审批所需的所有角色和权限的用户帐户创建终结点,则可以在一个步骤中执行此作。 否则,需要两个不同的用户执行两个单独的步骤。
设置专用链接时,弹性 SAN 和虚拟网络可能位于不同的资源组、区域和订阅中,包括属于不同Microsoft Entra 租户的订阅。 在这些示例中,我们在与虚拟网络相同的资源组中创建专用终结点。
在创建卷组或修改现有卷组时,可以在 Azure 门户中创建与卷组的专用终结点连接。 需要现有虚拟网络才能创建专用终结点。
创建或修改卷组时,选择“网络”,然后在“专用终结点连接”下选择“+创建专用终结点”。
在弹出菜单中填写值,选择可供应用程序用来进行连接的虚拟网络和子网。 完成后,选择“ 添加”和 “保存”。
以下脚本为您的弹性 SAN 卷组创建专用终结点。 将 RgName
、VnetName
、SubnetName
、EsanName
、EsanVgName
、PLSvcConnectionName
、EndpointName
和 Location
(区域) 的值替换为您自己的值,如果使用两个步骤的过程,请取消注释 -ByManualRequest
,然后运行脚本。
之后,如果没有所有必要的权限,并且需要网络管理员批准连接,请确保还要在 “批准连接”中运行脚本。
# Set the resource group name.
$RgName = "<ResourceGroupName>"
# Set the virtual network and subnet, which is used when creating the private endpoint.
$VnetName = "<VnetName>"
$SubnetName = "<SubnetName>"
$Vnet = Get-AzVirtualNetwork -Name $VnetName -ResourceGroupName $RgName
$Subnet = $Vnet | Select -ExpandProperty subnets | Where-Object {$_.Name -eq $SubnetName}
# Set the Elastic SAN, which is used when creating the private endpoint service connection.
$EsanName = "<ElasticSanName>"
$EsanVgName = "<ElasticSanVolumeGroupName>"
$Esan = Get-AzElasticSan -Name $EsanName -ResourceGroupName $RgName
# Create the private link service connection, which is input to creating the private endpoint.
$PLSvcConnectionName = "<PrivateLinkSvcConnectionName>"
$EsanPlSvcConn = New-AzPrivateLinkServiceConnection -Name $PLSvcConnectionName -PrivateLinkServiceId $Esan.Id -GroupId $EsanVgName
# Create the private endpoint.
$EndpointName = '<PrivateEndpointName>'
$Location = '<Location>'
$PeArguments = @{
Name = $EndpointName
ResourceGroupName = $RgName
Location = $Location
Subnet = $Subnet
PrivateLinkServiceConnection = $EsanPlSvcConn
}
New-AzPrivateEndpoint @PeArguments # -ByManualRequest # (Uncomment the `-ByManualRequest` parameter if you are using the two-step process).
批准连接
如果使用两步流程,请使用此示例代码批准专用链接服务连接。 使用上一代码示例中的相同变量:
# Get the private endpoint and associated connection.
$PrivateEndpoint = Get-AzPrivateEndpoint -Name $EndpointName -ResourceGroupName $RgName
$PeConnArguments = @{
ServiceName = $EsanName
ResourceGroupName = $RgName
PrivateLinkResourceType = "Microsoft.ElasticSan/elasticSans"
}
$EndpointConnection = Get-AzPrivateEndpointConnection @PeConnArguments |
Where-Object {($_.PrivateEndpoint.Id -eq $PrivateEndpoint.Id)}
# Approve the private link service connection.
$ApprovalDesc="<ApprovalDesc>"
Approve-AzPrivateEndpointConnection @PeConnArguments -Name $EndpointConnection.Name -Description $ApprovalDesc
# Get the private endpoint connection anew and verify the connection status.
$EndpointConnection = Get-AzPrivateEndpointConnection @PeConnArguments |
Where-Object {($_.PrivateEndpoint.Id -eq $PrivateEndpoint.Id)}
$EndpointConnection.PrivateLinkServiceConnectionState
以下脚本为您的弹性 SAN 卷组创建专用终结点。 如果使用两步流程,则取消注释 --manual-request
参数。 将所有示例变量值替换为你自己的变量值,然后运行脚本。
之后,如果没有所有必要的权限,并且需要网络管理员批准连接,请确保还要在 “批准连接”中运行脚本。
# Define some variables.
# The name of the resource group where the resources are deployed.
RgName="<ResourceGroupName>"
# The name of the subnet from which access to the volume group will be configured.
VnetName="<VnetName>"
# The name of the virtual network that includes the subnet.
SubnetName="<SubnetName>"
# The name of the Elastic SAN that the volume group belongs to.
EsanName="<ElasticSanName>"
# The name of the Elastic SAN Volume Group to which a connection is to be created.
EsanVgName="<ElasticSanVolumeGroupName>"
# The name of the new private endpoint
EndpointName="<PrivateEndpointName>"
# The name of the new private link service connection to the volume group.
PLSvcConnectionName="<PrivateLinkSvcConnectionName>"
# The region where the new private endpoint will be created.
Location="<Location>"
# The description provided for the approval of the private endpoint connection.
ApprovalDesc="<ApprovalDesc>"
# Get the id of the Elastic SAN.
id=$(az elastic-san show \
--elastic-san-name $EsanName \
--resource-group $RgName \
--query 'id' \
--output tsv)
# Create the private endpoint.
az network private-endpoint create \
--connection-name $PLSvcConnectionName \
--name $EndpointName \
--private-connection-resource-id $id \
--resource-group $RgName \
--vnet-name $VnetName \
--subnet $SubnetName \
--___location $Location \
--group-id $EsanVgName # --manual-request
# Verify the status of the private endpoint connection.
PLConnectionName=$(az network private-endpoint-connection list \
--name $EsanName \
--resource-group $RgName \
--type Microsoft.ElasticSan/elasticSans \
--query "[?properties.groupIds[0]=='$EsanVgName'].name" -o tsv)
az network private-endpoint-connection show \
--resource-name $EsanName \
--resource-group $RgName \
--type Microsoft.ElasticSan/elasticSans \
--name $PLConnectionName
批准连接
如果使用两步流程,请使用此示例代码批准专用链接服务连接。 使用上一代码示例中的相同变量:
az network private-endpoint-connection approve \
--resource-name $EsanName \
--resource-group $RgName \
--name $PLConnectionName \
--type Microsoft.ElasticSan/elasticSans \
--description $ApprovalDesc
注释
如果 Elastic SAN 和专用终结点位于不同的订阅中,请在包含专用终结点的订阅中注册 Microsoft.ElasticSan 资源提供程序。
按照 本文 中的步骤批准和注册私有终结点。
可选 - 网络策略
虚拟网络规则不适用于专用终结点。 因此,如果需要优化访问规则和控制通过专用终结点的流量,请使用网络策略。 默认情况下,虚拟网络中的子网禁用网络策略。 若要使用用户定义的路由和网络安全组支持等网络策略,请为子网启用网络策略支持。 此设置仅适用于子网中的专用终结点,并影响子网中的所有专用终结点。 对于子网中的其他资源,将根据网络安全组的安全规则控制访问。 有关详细信息,请参阅 网络策略。
启用所需终结点后,就可以配置客户端以连接到适当的弹性 SAN 卷。
如果虚拟机 (VM) 与弹性 SAN 卷之间的连接丢失,连接将重试 90 秒,直到终止。 失去与弹性 SAN 卷的连接不会导致 VM 重启。
后续步骤