Skip to content

Commit 0fed50f

Browse files
Merge pull request #242771 from asudbring/pls-posh-diagram
Added diagram and changed values to match Private Link Service Quickstart - PowerShell
2 parents 8033454 + 7721a8c commit 0fed50f

File tree

1 file changed

+58
-51
lines changed

1 file changed

+58
-51
lines changed

articles/private-link/create-private-link-service-powershell.md

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: private-link
55
author: asudbring
66
ms.service: private-link
77
ms.topic: quickstart
8-
ms.date: 02/02/2023
8+
ms.date: 06/23/2023
99
ms.author: allensu
1010
ms.custom: devx-track-azurepowershell, mode-api, template-quickstart
1111
#Customer intent: As someone with a basic network background, but is new to Azure, I want to create an Azure private link service
@@ -15,12 +15,19 @@ ms.custom: devx-track-azurepowershell, mode-api, template-quickstart
1515

1616
Get started creating a Private Link service that refers to your service. Give Private Link access to your service or resource deployed behind an Azure Standard Load Balancer. Users of your service have private access from their virtual network.
1717

18+
:::image type="content" source="./media/create-private-link-service-portal/private-link-service-qs-resources.png" alt-text="Diagram of resources created in private endpoint quickstart.":::
19+
1820
## Prerequisites
1921

2022
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
21-
- Azure PowerShell installed locally or Azure Cloud Shell
2223

23-
If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
24+
- Azure Cloud Shell or Azure PowerShell.
25+
26+
The steps in this quickstart run the Azure PowerShell cmdlets interactively in [Azure Cloud Shell](/azure/cloud-shell/overview). To run the commands in the Cloud Shell, select **Open Cloudshell** at the upper-right corner of a code block. Select **Copy** to copy the code and then paste it into Cloud Shell to run it. You can also run the Cloud Shell from within the Azure portal.
27+
28+
You can also [install Azure PowerShell locally](/powershell/azure/install-azure-powershell) to run the cmdlets. The steps in this article require Azure PowerShell module version 5.4.1 or later. Run `Get-Module -ListAvailable Az` to find your installed version. If you need to upgrade, see [Update the Azure PowerShell module](/powershell/azure/install-Az-ps#update-the-azure-powershell-module).
29+
30+
If you run PowerShell locally, run `Connect-AzAccount` to connect to Azure.
2431

2532
## Create a resource group
2633

@@ -29,13 +36,13 @@ An Azure resource group is a logical container into which Azure resources are de
2936
Create a resource group with [New-AzResourceGroup](/powershell/module/az.resources/new-azresourcegroup):
3037

3138
```azurepowershell-interactive
32-
New-AzResourceGroup -Name 'CreatePrivLinkService-rg' -Location 'eastus2'
39+
New-AzResourceGroup -Name 'test-rg' -Location 'eastus2'
3340
3441
```
3542

3643
## Create an internal load balancer
3744

38-
In this section, you'll create a virtual network and an internal Azure Load Balancer.
45+
In this section, you create a virtual network and an internal Azure Load Balancer.
3946

4047
### Virtual network
4148

@@ -46,17 +53,17 @@ In this section, you create a virtual network and subnet to host the load balanc
4653
```azurepowershell-interactive
4754
## Create backend subnet config ##
4855
$subnet = @{
49-
Name = 'mySubnet'
50-
AddressPrefix = '10.1.0.0/24'
56+
Name = 'subnet-1'
57+
AddressPrefix = '10.0.0.0/24'
5158
}
5259
$subnetConfig = New-AzVirtualNetworkSubnetConfig @subnet
5360
5461
## Create the virtual network ##
5562
$net = @{
56-
Name = 'myVNet'
57-
ResourceGroupName = 'CreatePrivLinkService-rg'
63+
Name = 'vnet-1'
64+
ResourceGroupName = 'test-rg'
5865
Location = 'eastus2'
59-
AddressPrefix = '10.1.0.0/16'
66+
AddressPrefix = '10.0.0.0/16'
6067
Subnet = $subnetConfig
6168
}
6269
$vnet = New-AzVirtualNetwork @net
@@ -80,22 +87,22 @@ This section details how you can create and configure the following components o
8087

8188
```azurepowershell-interactive
8289
## Place virtual network created in previous step into a variable. ##
83-
$vnet = Get-AzVirtualNetwork -Name 'myVNet' -ResourceGroupName 'CreatePrivLinkService-rg'
90+
$vnet = Get-AzVirtualNetwork -Name 'vnet-1' -ResourceGroupName 'test-rg'
8491
8592
## Create load balancer frontend configuration and place in variable. ##
8693
$lbip = @{
87-
Name = 'myFrontEnd'
88-
PrivateIpAddress = '10.1.0.4'
94+
Name = 'frontend'
95+
PrivateIpAddress = '10.0.0.4'
8996
SubnetId = $vnet.subnets[0].Id
9097
}
9198
$feip = New-AzLoadBalancerFrontendIpConfig @lbip
9299
93100
## Create backend address pool configuration and place in variable. ##
94-
$bepool = New-AzLoadBalancerBackendAddressPoolConfig -Name 'myBackEndPool'
101+
$bepool = New-AzLoadBalancerBackendAddressPoolConfig -Name 'backend-pool'
95102
96103
## Create the health probe and place in variable. ##
97104
$probe = @{
98-
Name = 'myHealthProbe'
105+
Name = 'health-probe'
99106
Protocol = 'http'
100107
Port = '80'
101108
IntervalInSeconds = '360'
@@ -106,7 +113,7 @@ $healthprobe = New-AzLoadBalancerProbeConfig @probe
106113
107114
## Create the load balancer rule and place in variable. ##
108115
$lbrule = @{
109-
Name = 'myHTTPRule'
116+
Name = 'http-rule'
110117
Protocol = 'tcp'
111118
FrontendPort = '80'
112119
BackendPort = '80'
@@ -118,8 +125,8 @@ $rule = New-AzLoadBalancerRuleConfig @lbrule -EnableTcpReset
118125
119126
## Create the load balancer resource. ##
120127
$loadbalancer = @{
121-
ResourceGroupName = 'CreatePrivLinkService-rg'
122-
Name = 'myLoadBalancer'
128+
ResourceGroupName = 'test-rg'
129+
Name = 'load-balancer'
123130
Location = 'eastus2'
124131
Sku = 'Standard'
125132
FrontendIpConfiguration = $feip
@@ -139,12 +146,12 @@ Before a private link service can be created in the virtual network, the setting
139146

140147
```azurepowershell-interactive
141148
## Place the subnet name into a variable. ##
142-
$subnet = 'mySubnet'
149+
$subnet = 'subnet-1'
143150
144151
## Place the virtual network configuration into a variable. ##
145152
$net = @{
146-
Name = 'myVNet'
147-
ResourceGroupName = 'CreatePrivLinkService-rg'
153+
Name = 'vnet-1'
154+
ResourceGroupName = 'test-rg'
148155
}
149156
$vnet = Get-AzVirtualNetwork @net
150157
@@ -165,27 +172,27 @@ In this section, create a private link service that uses the Standard Azure Load
165172

166173
```azurepowershell-interactive
167174
## Place the virtual network into a variable. ##
168-
$vnet = Get-AzVirtualNetwork -Name 'myVNet' -ResourceGroupName 'CreatePrivLinkService-rg'
175+
$vnet = Get-AzVirtualNetwork -Name 'vnet-1' -ResourceGroupName 'test-rg'
169176
170177
## Create the IP configuration for the private link service. ##
171178
$ipsettings = @{
172-
Name = 'myIPconfig'
173-
PrivateIpAddress = '10.1.0.5'
179+
Name = 'ipconfig-1'
180+
PrivateIpAddress = '10.0.0.5'
174181
Subnet = $vnet.subnets[0]
175182
}
176183
$ipconfig = New-AzPrivateLinkServiceIpConfig @ipsettings
177184
178185
## Place the load balancer frontend configuration into a variable. ##
179186
$par = @{
180-
Name = 'myLoadBalancer'
181-
ResourceGroupName = 'CreatePrivLinkService-rg'
187+
Name = 'load-balancer'
188+
ResourceGroupName = 'test-rg'
182189
}
183190
$fe = Get-AzLoadBalancer @par | Get-AzLoadBalancerFrontendIpConfig
184191
185192
## Create the private link service for the load balancer. ##
186193
$privlinksettings = @{
187-
Name = 'myPrivateLinkService'
188-
ResourceGroupName = 'CreatePrivLinkService-rg'
194+
Name = 'private-link-service'
195+
ResourceGroupName = 'test-rg'
189196
Location = 'eastus2'
190197
LoadBalancerFrontendIpConfiguration = $fe
191198
IpConfiguration = $ipconfig
@@ -198,7 +205,7 @@ Your private link service is created and can receive traffic. If you want to see
198205

199206
## Create private endpoint
200207

201-
In this section, you'll map the private link service to a private endpoint. A virtual network contains the private endpoint for the private link service. This virtual network contains the resources that will access your private link service.
208+
In this section, you map the private link service to a private endpoint. A virtual network contains the private endpoint for the private link service. This virtual network contains the resources that access your private link service.
202209

203210
### Create private endpoint virtual network
204211

@@ -207,17 +214,17 @@ In this section, you'll map the private link service to a private endpoint. A vi
207214
```azurepowershell-interactive
208215
## Create backend subnet config ##
209216
$subnet = @{
210-
Name = 'mySubnetPE'
211-
AddressPrefix = '11.1.0.0/24'
217+
Name = 'subnet-pe'
218+
AddressPrefix = '10.1.0.0/24'
212219
}
213220
$subnetConfig = New-AzVirtualNetworkSubnetConfig @subnet
214221
215222
## Create the virtual network ##
216223
$net = @{
217-
Name = 'myVNetPE'
218-
ResourceGroupName = 'CreatePrivLinkService-rg'
224+
Name = 'vnet-pe'
225+
ResourceGroupName = 'test-rg'
219226
Location = 'eastus2'
220-
AddressPrefix = '11.1.0.0/16'
227+
AddressPrefix = '10.1.0.0/16'
221228
Subnet = $subnetConfig
222229
}
223230
$vnetpe = New-AzVirtualNetwork @net
@@ -235,29 +242,29 @@ $vnetpe = New-AzVirtualNetwork @net
235242
```azurepowershell-interactive
236243
## Place the private link service configuration into variable. ##
237244
$par1 = @{
238-
Name = 'myPrivateLinkService'
239-
ResourceGroupName = 'CreatePrivLinkService-rg'
245+
Name = 'private-link-service'
246+
ResourceGroupName = 'test-rg'
240247
}
241248
$pls = Get-AzPrivateLinkService @par1
242249
243250
## Create the private link configuration and place in variable. ##
244251
$par2 = @{
245-
Name = 'myPrivateLinkConnection'
252+
Name = 'connection-1'
246253
PrivateLinkServiceId = $pls.Id
247254
}
248255
$plsConnection = New-AzPrivateLinkServiceConnection @par2
249256
250257
## Place the virtual network into a variable. ##
251258
$par3 = @{
252-
Name = 'myVNetPE'
253-
ResourceGroupName = 'CreatePrivLinkService-rg'
259+
Name = 'vnet-pe'
260+
ResourceGroupName = 'test-rg'
254261
}
255262
$vnetpe = Get-AzVirtualNetwork @par3
256263
257264
## Create private endpoint ##
258265
$par4 = @{
259-
Name = 'MyPrivateEndpoint'
260-
ResourceGroupName = 'CreatePrivLinkService-rg'
266+
Name = 'private-endpoint'
267+
ResourceGroupName = 'test-rg'
261268
Location = 'eastus2'
262269
Subnet = $vnetpe.subnets[0]
263270
PrivateLinkServiceConnection = $plsConnection
@@ -267,22 +274,22 @@ New-AzPrivateEndpoint @par4 -ByManualRequest
267274

268275
### Approve the private endpoint connection
269276

270-
In this section, you'll approve the connection you created in the previous steps.
277+
In this section, you approve the connection you created in the previous steps.
271278

272279
* Use [Approve-AzPrivateEndpointConnection](/powershell/module/az.network/approve-azprivateendpointconnection) to approve the connection.
273280

274281
```azurepowershell-interactive
275282
## Place the private link service configuration into variable. ##
276283
$par1 = @{
277-
Name = 'myPrivateLinkService'
278-
ResourceGroupName = 'CreatePrivLinkService-rg'
284+
Name = 'private-link-service'
285+
ResourceGroupName = 'test-rg'
279286
}
280287
$pls = Get-AzPrivateLinkService @par1
281288
282289
$par2 = @{
283290
Name = $pls.PrivateEndpointConnections[0].Name
284-
ServiceName = 'myPrivateLinkService'
285-
ResourceGroupName = 'CreatePrivLinkService-rg'
291+
ServiceName = 'private-link-service'
292+
ResourceGroupName = 'test-rg'
286293
Description = 'Approved'
287294
PrivateLinkResourceType = 'Microsoft.Network/privateLinkServices'
288295
}
@@ -292,15 +299,15 @@ Approve-AzPrivateEndpointConnection @par2
292299

293300
### IP address of private endpoint
294301

295-
In this section, you'll find the IP address of the private endpoint that corresponds with the load balancer and private link service.
302+
In this section, you find the IP address of the private endpoint that corresponds with the load balancer and private link service.
296303

297304
* Use [Get-AzPrivateEndpoint](/powershell/module/az.network/get-azprivateendpoint) to retrieve the IP address.
298305

299306
```azurepowershell-interactive
300307
## Get private endpoint and the IP address and place in a variable for display. ##
301308
$par1 = @{
302-
Name = 'myPrivateEndpoint'
303-
ResourceGroupName = 'CreatePrivLinkService-rg'
309+
Name = 'private-endpoint'
310+
ResourceGroupName = 'test-rg'
304311
ExpandResource = 'networkinterfaces'
305312
}
306313
$pe = Get-AzPrivateEndpoint @par1
@@ -311,15 +318,15 @@ $pe.NetworkInterfaces[0].IpConfigurations[0].PrivateIpAddress
311318

312319
```powershell
313320
❯ $pe.NetworkInterfaces[0].IpConfigurations[0].PrivateIpAddress
314-
11.1.0.4
321+
10.1.0.4
315322
```
316323

317324
## Clean up resources
318325

319326
When no longer needed, you can use the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command to remove the resource group, load balancer, and the remaining resources.
320327

321328
```azurepowershell-interactive
322-
Remove-AzResourceGroup -Name 'CreatePrivLinkService-rg'
329+
Remove-AzResourceGroup -Name 'test-rg'
323330
```
324331

325332
## Next steps

0 commit comments

Comments
 (0)