# Get the subnet details for the virtual network
$subnet = (Get-AzVirtualNetwork -Name <VNetName> -ResourceGroupName <ResourceGroupName>).Subnets | ? Name -eq <SubnetName>
執行下列命令,為具有連線子資源的主機集區建立 Private Link 服務連線。
# Get the resource ID of the host pool
$hostPoolId = (Get-AzWvdHostPool -Name <HostPoolName> -ResourceGroupName <ResourceGroupName>).Id
# Create the service connection
$parameters = @{
Name = '<ServiceConnectionName>'
PrivateLinkServiceId = $hostPoolId
GroupId = 'connection'
}
$serviceConnection = New-AzPrivateLinkServiceConnection @parameters
最後,執行下列其中一個範例中的命令來建立私人端點。
若要建立具有動態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network and session hosts.
$location = '<Location>'
# Create the private endpoint
$parameters = @{
Name = '<PrivateEndpointName>'
ResourceGroupName = '<ResourceGroupName>'
Location = $location
Subnet = $subnet
PrivateLinkServiceConnection = $serviceConnection
}
New-AzPrivateEndpoint @parameters
若要建立具有靜態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network and session hosts.
$location = '<Location>'
# Create a hash table for each private endpoint IP configuration
$ip1 = @{
Name = 'ipconfig1'
GroupId = 'connection'
MemberName = 'broker'
PrivateIPAddress = '<IPAddress>'
}
$ip2 = @{
Name = 'ipconfig2'
GroupId = 'connection'
MemberName = 'diagnostics'
PrivateIPAddress = '<IPAddress>'
}
$ip3 = @{
Name = 'ipconfig3'
GroupId = 'connection'
MemberName = 'gateway-ring-map'
PrivateIPAddress = '<IPAddress>'
}
$ip4 = @{
Name = 'ipconfig4'
GroupId = 'connection'
MemberName = 'web'
PrivateIPAddress = '<IPAddress>'
}
# Create the private endpoint IP configurations
$ipConfig1 = New-AzPrivateEndpointIpConfiguration @ip1
$ipConfig2 = New-AzPrivateEndpointIpConfiguration @ip2
$ipConfig3 = New-AzPrivateEndpointIpConfiguration @ip3
$ipConfig4 = New-AzPrivateEndpointIpConfiguration @ip4
# Create the private endpoint
$parameters = @{
Name = '<PrivateEndpointName>'
ResourceGroupName = '<ResourceGroupName>'
Location = $location
Subnet = $subnet
PrivateLinkServiceConnection = $serviceConnection
IpConfiguration = $ipConfig1, $ipConfig2, $ipConfig3, $ipConfig4
}
New-AzPrivateEndpoint @parameters
您必須為私人端點設定 DNS (部分機器翻譯),才能解析虛擬網路中私人端點的 DNS 名稱。 私人 DNS 區域的名稱是 privatelink.wvd.microsoft.com。 如需使用 Azure PowerShell 建立和設定私人 DNS 區域的步驟,請參閱設定私人 DNS 區域 (部分機器翻譯)。
執行下列其中一個範例中的命令,為具有連線子資源的主機集區建立 Private Link 服務連線和私人端點。
若要建立具有動態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network and session hosts.
location=<Location>
# Get the resource ID of the host pool
hostPoolId=$(az desktopvirtualization hostpool show \
--name <HostPoolName> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Create a service connection and the private endpoint
az network private-endpoint create \
--name <PrivateEndpointName> \
--resource-group <ResourceGroupName> \
--location $location \
--vnet-name <VNetName> \
--subnet <SubnetName> \
--connection-name <ConnectionName> \
--private-connection-resource-id $hostPoolId \
--group-id connection \
--output table
若要建立具有靜態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network and session hosts.
location=<Location>
# Get the resource ID of the host pool
hostPoolId=$(az desktopvirtualization hostpool show \
--name <HostPoolName> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Store each private endpoint IP configuration in a variable
ip1={name:ipconfig1,group-id:connection,member-name:broker,private-ip-address:<IPAddress>}
ip2={name:ipconfig2,group-id:connection,member-name:diagnostics,private-ip-address:<IPAddress>}
ip3={name:ipconfig3,group-id:connection,member-name:gateway-ring-map,private-ip-address:<IPAddress>}
ip4={name:ipconfig4,group-id:connection,member-name:web,private-ip-address:<IPAddress>}
# Create a service connection and the private endpoint
az network private-endpoint create \
--name <PrivateEndpointName> \
--resource-group <ResourceGroupName> \
--location $location \
--vnet-name <VNetName> \
--subnet <SubnetName> \
--connection-name <ConnectionName> \
--private-connection-resource-id $hostPoolId \
--group-id connection \
--ip-configs [$ip1,$ip2,$ip3,$ip4] \
--output table
在相同的 PowerShell 工作階段中執行下列命令,為具有摘要子資源的工作區建立 Private Link 服務連線。 這些範例會使用相同的虛擬網路和子網路。
# Get the resource ID of the workspace
$workspaceId = (Get-AzWvdWorkspace -Name <WorkspaceName> -ResourceGroupName <ResourceGroupName>).Id
# Create the service connection
$parameters = @{
Name = '<ServiceConnectionName>'
PrivateLinkServiceId = $workspaceId
GroupId = 'feed'
}
$serviceConnection = New-AzPrivateLinkServiceConnection @parameters
最後,執行下列其中一個範例中的命令來建立私人端點。
若要建立具有動態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
$location = '<Location>'
# Create the private endpoint
$parameters = @{
Name = '<PrivateEndpointName>'
ResourceGroupName = '<ResourceGroupName>'
Location = $location
Subnet = $subnet
PrivateLinkServiceConnection = $serviceConnection
}
New-AzPrivateEndpoint @parameters
若要建立具有靜態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
$location = '<Location>'
# Create a hash table for each private endpoint IP configuration
$ip1 = @{
Name = 'ipconfig1'
GroupId = 'feed'
MemberName = 'web-r1'
PrivateIPAddress = '<IPAddress>'
}
$ip2 = @{
Name = 'ipconfig2'
GroupId = 'feed'
MemberName = 'web-r0'
PrivateIPAddress = '<IPAddress>'
}
# Create the private endpoint IP configurations
$ipConfig1 = New-AzPrivateEndpointIpConfiguration @ip1
$ipConfig2 = New-AzPrivateEndpointIpConfiguration @ip2
# Create the private endpoint
$parameters = @{
Name = '<PrivateEndpointName>'
ResourceGroupName = '<ResourceGroupName>'
Location = $location
Subnet = $subnet
PrivateLinkServiceConnection = $serviceConnection
IpConfiguration = $ipConfig1, $ipConfig2
}
New-AzPrivateEndpoint @parameters
您必須為私人端點設定 DNS (部分機器翻譯),才能解析虛擬網路中私人端點的 DNS 名稱。 私人 DNS 區域的名稱是 privatelink.wvd.microsoft.com。 如需使用 Azure PowerShell 建立和設定私人 DNS 區域的步驟,請參閱設定私人 DNS 區域 (部分機器翻譯)。
在相同的 CLI 工作階段中執行下列命令,為具有摘要子資源的工作區建立 Private Link 服務連線和私人端點。
若要建立具有動態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
location=<Location>
# Get the resource ID of the workspace
workspaceId=$(az desktopvirtualization workspace show \
--name <WorkspaceName> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Create a service connection and the private endpoint
az network private-endpoint create \
--name <PrivateEndpointName> \
--resource-group <ResourceGroupName> \
--location $location \
--vnet-name <VNetName> \
--subnet <SubnetName> \
--connection-name <ConnectionName> \
--private-connection-resource-id $workspaceId \
--group-id feed \
--output table
若要建立具有靜態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
location=<Location>
# Get the resource ID of the workspace
workspaceId=$(az desktopvirtualization workspace show \
--name <WorkspaceName> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Store each private endpoint IP configuration in a variable
ip1={name:ipconfig1,group-id:feed,member-name:web-r1,private-ip-address:<IPAddress>}
ip2={name:ipconfig2,group-id:feed,member-name:web-r0,private-ip-address:<IPAddress>}
# Create a service connection and the private endpoint
az network private-endpoint create \
--name <PrivateEndpointName> \
--resource-group <ResourceGroupName> \
--location $location \
--vnet-name <VNetName> \
--subnet <SubnetName> \
--connection-name <ConnectionName> \
--private-connection-resource-id $workspaceId \
--group-id feed \
--ip-configs [$ip1,$ip2] \
--output table
在相同的 PowerShell 工作階段中執行下列命令,為具有全域子資源的工作區建立 Private Link 服務連線。 這些範例會使用相同的虛擬網路和子網路。
# Get the resource ID of the workspace
$workspaceId = (Get-AzWvdWorkspace -Name <WorkspaceName> -ResourceGroupName <ResourceGroupName>).Id
# Create the service connection
$parameters = @{
Name = '<ServiceConnectionName>'
PrivateLinkServiceId = $workspaceId
GroupId = 'global'
}
$serviceConnection = New-AzPrivateLinkServiceConnection @parameters
最後,執行下列其中一個範例中的命令來建立私人端點。
若要建立具有動態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
$location = '<Location>'
# Create the private endpoint
$parameters = @{
Name = '<PrivateEndpointName>'
ResourceGroupName = '<ResourceGroupName>'
Location = $location
Subnet = $subnet
PrivateLinkServiceConnection = $serviceConnection
}
New-AzPrivateEndpoint @parameters
若要建立具有靜態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
$location = '<Location>'
$ip = @{
Name = '<IPConfigName>'
GroupId = 'global'
MemberName = 'web'
PrivateIPAddress = '<IPAddress>'
}
$ipConfig = New-AzPrivateEndpointIpConfiguration @ip
# Create the private endpoint
$parameters = @{
Name = '<PrivateEndpointName>'
ResourceGroupName = '<ResourceGroupName>'
Location = $location
Subnet = $subnet
PrivateLinkServiceConnection = $serviceConnection
IpConfiguration = $ipconfig
}
New-AzPrivateEndpoint @parameters
您必須為私人端點設定 DNS (部分機器翻譯),才能解析虛擬網路中私人端點的 DNS 名稱。 私人 DNS 區域的名稱是 privatelink-global.wvd.microsoft.com。 如需使用 Azure PowerShell 建立和設定私人 DNS 區域的步驟,請參閱設定私人 DNS 區域 (部分機器翻譯)。
在相同的 CLI 工作階段中執行下列命令,為具有全域子資源的工作區建立 Private Link 服務連線和私人端點:
若要建立具有動態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
location=<Location>
# Get the resource ID of the workspace
workspaceId=$(az desktopvirtualization workspace show \
--name <WorkspaceName> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Create a service connection and the private endpoint
az network private-endpoint create \
--name <PrivateEndpointName> \
--resource-group <ResourceGroupName> \
--location $location \
--vnet-name <VNetName> \
--subnet <SubnetName> \
--connection-name <ConnectionName> \
--private-connection-resource-id $workspaceId \
--group-id global \
--output table
若要建立具有靜態配置 IP 位址的私人端點:
# Specify the Azure region. This must be the same region as your virtual network.
location=<Location>
# Get the resource ID of the workspace
workspaceId=$(az desktopvirtualization workspace show \
--name <WorkspaceName> \
--resource-group <ResourceGroupName> \
--query [id] \
--output tsv)
# Store each private endpoint IP configuration in a variable
ip={name:ipconfig,group-id:global,member-name:web,private-ip-address:<IPAddress>}
# Create a service connection and the private endpoint
az network private-endpoint create \
--name <PrivateEndpointName> \
--resource-group <ResourceGroupName> \
--location $location \
--vnet-name <VNetName> \
--subnet <SubnetName> \
--connection-name <ConnectionName> \
--private-connection-resource-id $workspaceId \
--group-id global \
--ip-config $ip \
--output table
您必須為私人端點設定 DNS (部分機器翻譯),才能解析虛擬網路中私人端點的 DNS 名稱。 私人 DNS 區域的名稱是 privatelink-global.wvd.microsoft.com。 如需使用 Azure CLI 建立和設定私人 DNS 區域的步驟,請參閱設定私人 DNS 區域 (部分機器翻譯)。