Skip to content

Commit c4aa5ab

Browse files
Merge pull request #245010 from dknappettmsft/avd-private-link-powershell-preview
AVD private link added new preview PowerShell
2 parents 9cca5ee + 70661ba commit c4aa5ab

File tree

1 file changed

+106
-27
lines changed

1 file changed

+106
-27
lines changed

articles/virtual-desktop/private-link-setup.md

Lines changed: 106 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,9 @@ Once you've created private endpoints, you can also control if traffic is allowe
744744

745745
### Control routes with Azure Virtual Desktop
746746

747-
With Azure Virtual Desktop, you can independently control public traffic for workspaces and host pools. You need to repeat these steps for each workspace and host pool you use with Private Link.
747+
With Azure Virtual Desktop, you can independently control public traffic for workspaces and host pools. Select the relevant tab for your scenario and follow the steps. You can't configure this in Azure CLI. You need to repeat these steps for each workspace and host pool you use with Private Link.
748+
749+
# [Portal](#tab/portal-2)
748750

749751
#### Workspaces
750752

@@ -777,14 +779,95 @@ With Azure Virtual Desktop, you can independently control public traffic for wor
777779

778780
1. Select **Save**.
779781

782+
# [Azure PowerShell](#tab/powershell-2)
783+
780784
> [!IMPORTANT]
781-
> Selecting **Enable public access for end users, use private access for session hosts** or **Disable public access and use private access** won't affect existing sessions. You must restart the session host virtual machines for the change to take effect.
785+
> You need to use the preview version of the Az.DesktopVirtualization module to run the following commands. For more information and to download and install the preview module, see [PowerShell Gallery](https://www.powershellgallery.com/packages/Az.DesktopVirtualization/5.0.0-preview).
786+
787+
#### Workspaces
788+
789+
1. In the same PowerShell session, you can disable public access and use private access by running the following command:
790+
791+
```azurepowershell
792+
$parameters = @{
793+
Name = '<WorkspaceName>'
794+
ResourceGroupName = '<ResourceGroupName>'
795+
PublicNetworkAccess = 'Disabled'
796+
}
797+
798+
Update-AzWvdWorkspace @parameters
799+
```
800+
801+
1. To enable public access from all networks, run the following command:
802+
803+
```azurepowershell
804+
$parameters = @{
805+
Name = '<WorkspaceName>'
806+
ResourceGroupName = '<ResourceGroupName>'
807+
PublicNetworkAccess = 'Enabled'
808+
}
809+
810+
Update-AzWvdWorkspace @parameters
811+
```
812+
813+
#### Host pools
814+
815+
1. In the same PowerShell session, you can disable public access and use private access by running the following command:
816+
817+
```azurepowershell
818+
$parameters = @{
819+
Name = '<HostPoolName>'
820+
ResourceGroupName = '<ResourceGroupName>'
821+
PublicNetworkAccess = 'Disabled'
822+
}
823+
824+
Update-AzWvdHostPool @parameters
825+
```
826+
827+
1. To enable public access from all networks, run the following command:
828+
829+
```azurepowershell
830+
$parameters = @{
831+
Name = '<HostPoolName>'
832+
ResourceGroupName = '<ResourceGroupName>'
833+
PublicNetworkAccess = 'Enabled'
834+
}
835+
836+
Update-AzWvdHostPool @parameters
837+
```
838+
839+
1. To use public access for end users, but use private access for session hosts, run the following command:
840+
841+
```azurepowershell
842+
$parameters = @{
843+
Name = '<HostPoolName>'
844+
ResourceGroupName = '<ResourceGroupName>'
845+
PublicNetworkAccess = 'EnabledForSessionHostsOnly'
846+
}
847+
848+
Update-AzWvdHostPool @parameters
849+
```
850+
851+
1. To use private access for end users, but use public access for session hosts, run the following command:
852+
853+
```azurepowershell
854+
$parameters = @{
855+
Name = '<HostPoolName>'
856+
ResourceGroupName = '<ResourceGroupName>'
857+
PublicNetworkAccess = 'EnabledForClientsOnly'
858+
}
859+
860+
Update-AzWvdHostPool @parameters
861+
```
782862

783863
---
784864

865+
> [!IMPORTANT]
866+
> Changing access for session hosts won't affect existing sessions. You must restart the session host virtual machines for the change to take effect.
867+
785868
### Block public routes with network security groups or Azure Firewall
786869

787-
If you're using network security groups or Azure Firewall to control connections from user client devices or your session hosts to the private endpoints, you can use the **WindowsVirtualDesktop** service tag to block traffic from the public internet. If you block public internet traffic using this service tag, all service traffic uses private routes only.
870+
If you're using [network security groups](../virtual-network/network-security-groups-overview.md) or [Azure Firewall](../firewall/overview.md) to control connections from user client devices or your session hosts to the private endpoints, you can use the **WindowsVirtualDesktop** service tag to block traffic from the public internet. If you block public internet traffic using this service tag, all service traffic uses private routes only.
788871

789872
> [!CAUTION]
790873
> - Make sure you don't block traffic between your private endpoints and the addresses in the [required URL list](safe-url-list.md).
@@ -845,45 +928,41 @@ To check the connection state of each private endpoint, select the relevant tab
845928

846929
# [Azure PowerShell](#tab/powershell)
847930

931+
> [!IMPORTANT]
932+
> You need to use the preview version of the Az.DesktopVirtualization module to run the following commands. For more information and to download and install the preview module, see [PowerShell Gallery](https://www.powershellgallery.com/packages/Az.DesktopVirtualization/5.0.0-preview).
933+
934+
#### Workspaces
935+
848936
1. In the same PowerShell session, run the following commands to check the connection state of a workspace:
849937

850938
```azurepowershell
851-
# Get the resource ID of the workspace
852-
$workspaceId = (Get-AzWvdWorkspace -Name <WorkspaceName> -ResourceGroupName <ResourceGroupName>).Id
853-
854-
Get-AzPrivateEndpointConnection -PrivateLinkResourceId $workspaceId | FL Name, PrivateLinkServiceConnectionStateText
939+
(Get-AzWvdWorkspace -Name <WorkspaceName> -ResourceGroupName <ResourceGroupName).PrivateEndpointConnection | FL Name, PrivateLinkServiceConnectionStateStatus, PrivateLinkServiceConnectionStateDescription, PrivateLinkServiceConnectionStateActionsRequired
855940
```
856941

857-
Your output should be similar to the following. Check that the value for **Status** is **Approved**.
942+
Your output should be similar to the following. Check that the value for **PrivateLinkServiceConnectionStateStatus** is **Approved**.
858943

859944
```output
860-
Name : endpoint-ws01
861-
PrivateLinkServiceConnectionStateText : {
862-
"Status": "Approved",
863-
"Description": "Auto-approved",
864-
"ActionRequired": "None"
865-
}
945+
Name : endpoint-ws01
946+
PrivateLinkServiceConnectionStateStatus : Approved
947+
PrivateLinkServiceConnectionStateDescription : Auto-approved
948+
PrivateLinkServiceConnectionStateActionsRequired : None
866949
```
867950

868-
1. Run the following commands to check the connection state of a host pool:
951+
#### Host pools
952+
953+
1. In the same PowerShell session, run the following commands to check the connection state of a host pool:
869954

870955
```azurepowershell
871-
# Get the resource ID of the workspace
872-
$hostPoolId = (Get-AzWvdHostPool -Name <HostPoolName> -ResourceGroupName <ResourceGroupName>).Id
873-
874-
Get-AzPrivateEndpointConnection -PrivateLinkResourceId $hostPoolId | FL Name, PrivateLinkServiceConnectionStateText
956+
(Get-AzWvdHostPool -Name <HostPoolName> -ResourceGroupName <ResourceGroupName).PrivateEndpointConnection | FL Name, PrivateLinkServiceConnectionStateStatus, PrivateLinkServiceConnectionStateDescription, PrivateLinkServiceConnectionStateActionsRequired
875957
```
876958

877-
Your output should be similar to the following. Check that the value for **Status** is **Approved**.
959+
Your output should be similar to the following. Check that the value for **PrivateLinkServiceConnectionStateStatus** is **Approved**.
878960

879961
```output
880-
Name : endpoint-hp01
881-
PrivateLinkServiceConnectionStateText : {
882-
"Status": "Approved",
883-
"Description": "Auto-approved",
884-
"ActionRequired": "None"
885-
}
886-
```
962+
Name : endpoint-hp01
963+
PrivateLinkServiceConnectionStateStatus : Approved
964+
PrivateLinkServiceConnectionStateDescription : Auto-approved
965+
PrivateLinkServiceConnectionStateActionsRequired : None
887966
888967
---
889968

0 commit comments

Comments
 (0)