Skip to content

Commit 5573154

Browse files
committed
added tabs and fixed up code
1 parent 6db13f2 commit 5573154

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

articles/private-link/disable-private-link-service-network-policy.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: 'Disable network policies for Azure Private Link service source IP address '
33
description: Learn how to disable network policies for Azure private Link
44
services: private-link
5-
author: malopMSFT
5+
author: asudbring
66
ms.service: private-link
77
ms.topic: how-to
8-
ms.date: 09/16/2019
8+
ms.date: 02/02/2023
99
ms.author: allensu
1010
ms.custom: devx-track-azurepowershell, devx-track-azurecli
1111
ms.devlang: azurecli
@@ -17,32 +17,48 @@ In order to choose a source IP address for your Private Link service, an explici
1717

1818
When using the portal to create a Private Link service, this setting is automatically disabled as part of the create process. Deployments using any Azure client (PowerShell, CLI or templates), require an additional step to change this property. You can disable the policy using the cloud shell from the Azure portal, or local installations of Azure PowerShell, Azure CLI, or use Azure Resource Manager templates.
1919

20-
Follow the steps below to disable private link service network policies for a virtual network named *myVirtualNetwork* with a *default* subnet hosted in a resource group named *myResourceGroup*.
20+
You can use the following to enable or disable the setting:
2121

22-
## Using Azure PowerShell
23-
This section describes how to disable subnet private endpoint policies using Azure PowerShell.
24-
In the code, replace "default" with the name of the virtual subnet.
22+
* Azure PowerShell
2523

26-
```azurepowershell
27-
$virtualSubnetName = "default"
28-
$virtualNetwork= Get-AzVirtualNetwork `
29-
-Name "myVirtualNetwork" `
30-
-ResourceGroupName "myResourceGroup"
31-
32-
($virtualNetwork | Select -ExpandProperty subnets | Where-Object {$_.Name -eq $virtualSubnetName} ).privateLinkServiceNetworkPolicies = "Disabled"
24+
* Azure CLI
25+
26+
* Azure Resource Manager templates
3327

34-
$virtualNetwork | Set-AzVirtualNetwork
28+
The following examples describe how to enable and disable `privateLinkServiceNetworkPolicies` for a virtual network named **myVNet** with a **default** subnet of **10.1.0.0/24** hosted in a resource group named **myResourceGroup**.
29+
30+
# [**PowerShell**](#tab/private-link-network-policy-powershell)
31+
32+
This section describes how to disable subnet private endpoint policies using Azure PowerShell. In the following code, replace "default" with the name of your virtual subnet.
33+
34+
```azurepowershell
35+
$subnet = 'default'
36+
37+
$net = @{
38+
Name = 'myVNet'
39+
ResourceGroupName = 'myResourceGroup'
40+
}
41+
$vnet = Get-AzVirtualNetwork @net
42+
43+
($vnet | Select -ExpandProperty subnets | Where-Object {$_.Name -eq $subnet} ).privateLinkServiceNetworkPolicies = "Disabled"
44+
45+
$vnet | Set-AzVirtualNetwork
3546
```
36-
## Using Azure CLI
47+
48+
# [**CLI**](#tab/private-link-network-policy-cli)
49+
3750
This section describes how to disable subnet private endpoint policies using Azure CLI.
51+
3852
```azurecli
3953
az network vnet subnet update \
40-
--name default \
41-
--resource-group myResourceGroup \
42-
--vnet-name myVirtualNetwork \
43-
--disable-private-link-service-network-policies true
54+
--name default \
55+
--resource-group myResourceGroup \
56+
--vnet-name myVNet \
57+
--disable-private-link-service-network-policies true
4458
```
45-
## Using a template
59+
60+
# [JSON](#tab/private-link-network-policy-json)
61+
4662
This section describes how to disable subnet private endpoint policies using Azure Resource Manager Template.
4763
```json
4864
{
@@ -53,14 +69,14 @@ This section describes how to disable subnet private endpoint policies using Azu
5369
"properties": {
5470
"addressSpace": {
5571
"addressPrefixes": [
56-
"10.0.0.0/16"
72+
"10.1.0.0/16"
5773
]
5874
},
5975
"subnets": [
6076
{
6177
"name": "default",
6278
"properties": {
63-
"addressPrefix": "10.0.0.0/24",
79+
"addressPrefix": "10.1.0.0/24",
6480
"privateLinkServiceNetworkPolicies": "Disabled"
6581
}
6682
}
@@ -69,6 +85,10 @@ This section describes how to disable subnet private endpoint policies using Azu
6985
}
7086

7187
```
88+
89+
---
90+
7291
## Next steps
92+
7393
- Learn more about [Azure Private Endpoint](private-endpoint-overview.md)
7494

0 commit comments

Comments
 (0)