Skip to content

Commit 87b6e06

Browse files
Merge pull request #220786 from asudbring/pe-ddos-posh
Added DDoS info to VNET create for private endpoint create - Powershell
2 parents 4b65fa9 + 51e93e3 commit 87b6e06

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

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

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ Create a resource group with [New-AzResourceGroup](/powershell/module/az.resourc
4040
New-AzResourceGroup -Name 'CreatePrivateEndpointQS-rg' -Location 'eastus'
4141
```
4242

43+
### Create a DDoS Protection plan
44+
45+
Create a DDoS Protection plan with [New-AzDdosProtectionPlan](/powershell/module/az.network/new-azddosprotectionplan) to associate with the virtual network. This example creates a DDoS Protection plan named **myDDoSPlan** in the **EastUS** location:
46+
47+
```azurepowershell-interactive
48+
$ddosplan = @{
49+
Name = 'myDDoSPlan'
50+
ResourceGroupName = 'CreatePrivateEndpointQS-rg'
51+
Location = 'EastUS'
52+
}
53+
New-AzDdosProtectionPlan @ddosplan
54+
```
55+
4356
## Create a virtual network and bastion host
4457

4558
A virtual network and subnet is required for to host the private IP address for the private endpoint. You'll create a bastion host to connect securely to the virtual machine to test the private endpoint. You'll create the virtual machine in a later section.
@@ -55,19 +68,23 @@ In this section, you'll:
5568
- Create the bastion host with [New-AzBastion](/powershell/module/az.network/new-azbastion)
5669

5770
```azurepowershell-interactive
71+
## Place DDoS plan created previously into a variable. ##
72+
$ddosplan = Get-AzDdosProtectionPlan -ResourceGroupName CreatePrivateEndpointQS-rg -Name myDDosPlan
73+
5874
## Configure the back-end subnet. ##
59-
$subnetConfig = New-AzVirtualNetworkSubnetConfig -Name myBackendSubnet -AddressPrefix 10.0.0.0/24
75+
$subnetConfig = New-AzVirtualNetworkSubnetConfig -Name myBackendSubnet -AddressPrefix 10.1.0.0/24
6076
6177
## Create the Azure Bastion subnet. ##
62-
$bastsubnetConfig = New-AzVirtualNetworkSubnetConfig -Name AzureBastionSubnet -AddressPrefix 10.0.1.0/24
78+
$bastsubnetConfig = New-AzVirtualNetworkSubnetConfig -Name AzureBastionSubnet -AddressPrefix 10.1.1.0/24
6379
6480
## Create the virtual network. ##
6581
$net = @{
6682
Name = 'MyVNet'
6783
ResourceGroupName = 'CreatePrivateEndpointQS-rg'
6884
Location = 'eastus'
69-
AddressPrefix = '10.0.0.0/16'
85+
AddressPrefix = '10.1.0.0/16'
7086
Subnet = $subnetConfig, $bastsubnetConfig
87+
DDoSProtectionPlan = $ddosplan.Id
7188
}
7289
$vnet = New-AzVirtualNetwork @net
7390
@@ -160,7 +177,7 @@ $ip = @{
160177
Name = 'myIPconfig'
161178
GroupId = 'sites'
162179
MemberName = 'sites'
163-
PrivateIPAddress = '10.0.0.10'
180+
PrivateIPAddress = '10.1.0.10'
164181
}
165182
$ipconfig = New-AzPrivateEndpointIpConfiguration @ip
166183
@@ -324,6 +341,14 @@ Use the VM you created in the previous step to connect to the webapp across the
324341
325342
10. Close the connection to **myVM**.
326343
344+
## Clean up resources
345+
346+
When no longer needed, you can use the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command to remove the resource group, virtual network, and the remaining resources.
347+
348+
```azurepowershell-interactive
349+
Remove-AzResourceGroup -Name 'CreatePrivateEndpointQS-rg'
350+
```
351+
327352
## Next steps
328353

329354
For more information about the services that support private endpoints, see:

0 commit comments

Comments
 (0)