Skip to content

Commit 010bd2b

Browse files
committed
Add help documentation examples for certificate-based authentication feature
1 parent 0093e3b commit 010bd2b

File tree

3 files changed

+114
-38
lines changed

3 files changed

+114
-38
lines changed

src/Network/Network/help/New-AzVirtualNetworkGatewayCertificateAuthentication.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml
33
Module Name: Az.Network
4-
online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-azvirtualnetworkgatewaycertificateauthentication
4+
online version: https://learn.microsoft.com/powershell/module/az.network/update-aznetworksecurityperimeterloggingconfiguration
55
schema: 2.0.0
66
---
77

88
# New-AzVirtualNetworkGatewayCertificateAuthentication
99

1010
## SYNOPSIS
11-
Creates a certificate authentication object for VPN gateway connections.
11+
Creates a certificate authentication configuration object for VPN gateway connections.
1212

1313
## SYNTAX
1414

@@ -19,32 +19,33 @@ New-AzVirtualNetworkGatewayCertificateAuthentication [-OutboundAuthCertificate <
1919
```
2020

2121
## DESCRIPTION
22-
The New-AzVirtualNetworkGatewayCertificateAuthentication cmdlet creates a certificate authentication object that can be used with New-AzVirtualNetworkGatewayConnection to configure certificate-based authentication for VPN gateway connections. This enables secure authentication using certificates instead of pre-shared keys.
22+
Creates a certificate authentication configuration object that can be used when creating or updating a VPN gateway connection with certificate-based authentication.
2323

2424
## EXAMPLES
2525

26-
### Example 1: Create a certificate authentication object with outbound certificate
26+
### Example 1: Create a certificate authentication object
2727
```powershell
28-
PS C:\> $certAuth = New-AzVirtualNetworkGatewayCertificateAuthentication -OutboundAuthCertificate "https://myvault.vault.azure.net/secrets/client-cert"
28+
# Create certificate chain array with base64-encoded certificates (without BEGIN/END CERTIFICATE headers)
29+
$certChain = @(
30+
"MIIDfzCCAmegAwIBAgIQIFxjNWTuGjYGa8zJVnpfnDANBgkqhkiG9w0BAQsFADAYMRYwFAYDVQQDDA1DZXJ0QmFzZWRBdXRoMB4XDTI0MTIxODA1MjkzOVoXDTI1MTIxODA2MDk...",
31+
"MIIDezCCAmOgAwIBAgIQQIpJdJF8D8JwkqF6fJ6zGDANBgkqhkiG9w0BAQsFADAYMRYwFAYDVQQDDA1DZXJ0QmFzZWRBdXRoMB4XDTI0MTIxODA1MjkzOVoXDTI1MTIxODA2MDk..."
32+
)
33+
34+
$certAuth = New-AzVirtualNetworkGatewayCertificateAuthentication `
35+
-OutboundAuthCertificate "https://myvault.vault.azure.net/certificates/mycert/abc123" `
36+
-InboundAuthCertificateSubjectName "MyCertSubject" `
37+
-InboundAuthCertificateChain $certChain
2938
```
3039

31-
Creates a certificate authentication object with only an outbound authentication certificate from Azure Key Vault.
32-
33-
### Example 2: Create a complete certificate authentication object
34-
```powershell
35-
PS C:\> $certChain = @("-----BEGIN CERTIFICATE-----`nMIIC...`n-----END CERTIFICATE-----")
36-
PS C:\> $certAuth = New-AzVirtualNetworkGatewayCertificateAuthentication -OutboundAuthCertificate "https://myvault.vault.azure.net/secrets/client-cert" -InboundAuthCertificateSubjectName "CN=MyRootCA,O=MyOrg,C=US" -InboundAuthCertificateChain $certChain
37-
```
38-
39-
Creates a complete certificate authentication object with outbound certificate, inbound certificate subject name, and certificate chain.
40+
This example creates a certificate authentication object with a Key Vault certificate URL for outbound authentication, a certificate subject name for inbound authentication, and a certificate chain. This object can then be used with New-AzVirtualNetworkGatewayConnection or Set-AzVirtualNetworkGatewayConnection.
4041

4142
## PARAMETERS
4243

4344
### -DefaultProfile
4445
The credentials, account, tenant, and subscription used for communication with Azure.
4546

4647
```yaml
47-
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
48+
Type: IAzureContextContainer
4849
Parameter Sets: (All)
4950
Aliases: AzContext, AzureRmContext, AzureCredential
5051

@@ -59,7 +60,7 @@ Accept wildcard characters: False
5960
Inbound authentication certificate public keys.
6061
6162
```yaml
62-
Type: System.String[]
63+
Type: String[]
6364
Parameter Sets: (All)
6465
Aliases:
6566

@@ -74,7 +75,7 @@ Accept wildcard characters: False
7475
Inbound authentication certificate subject name.
7576
7677
```yaml
77-
Type: System.String
78+
Type: String
7879
Parameter Sets: (All)
7980
Aliases:
8081

@@ -89,7 +90,7 @@ Accept wildcard characters: False
8990
Keyvault secret ID for outbound authentication certificate.
9091
9192
```yaml
92-
Type: System.String
93+
Type: String
9394
Parameter Sets: (All)
9495
Aliases:
9596

@@ -104,7 +105,7 @@ Accept wildcard characters: False
104105
{{ Fill ProgressAction Description }}
105106
106107
```yaml
107-
Type: System.Management.Automation.ActionPreference
108+
Type: ActionPreference
108109
Parameter Sets: (All)
109110
Aliases: proga
110111

src/Network/Network/help/New-AzVirtualNetworkGatewayConnection.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,7 @@ The first command gets a virtual network gateway natRule named natRule1 that's t
7171
The second command gets a virtual network gateway natRule named natRule2 that's type is EgressSnat.
7272
The third command creates this new virtual Network gateway connection with Ingress and Egress NatRules.
7373

74-
### Example 3 Create VPN connection with certificate authentication
75-
```powershell
76-
$vnetgw1 = Get-AzVirtualNetworkGateway -ResourceGroupName "Rg1" -Name "gw1"
77-
$localnetgw = Get-AzLocalNetworkGateway -ResourceGroupName "Rg1" -name "localgw1"
78-
$certAuth = New-AzVirtualNetworkGatewayCertificateAuthentication -OutboundAuthCertificate "MIICmjCCAYIGCSqGSIb3DQEJEjEOMAwGCisGAQQBgjcCAQwwHAYJKoZIhvcNAQkFMQ8XDTEzMDEwMzEyNTk1OVowLwYJKoZIhvcNAQkEMSIEII8Xqf/JHKJzaOPoCdQf2c7jZwYmK1hc8LTfBrMJuXzi"
79-
80-
New-AzVirtualNetworkGatewayConnection -Name conn-cert-1 -ResourceGroupName "Rg1" -Location "eastus" -VirtualNetworkGateway1 $vnetgw1 -LocalNetworkGateway2 $localnetgw -ConnectionType IPsec -AuthenticationType Certificate -CertificateAuthentication $certAuth
81-
```
82-
83-
The first command gets a virtual network gateway.
84-
The second command gets a local network gateway.
85-
The third command creates a certificate authentication object.
86-
The fourth command creates a new VPN connection using certificate authentication.
87-
88-
### Example 4 Add GatewayCustomBgpIpAddress to virtual network gateway connection
74+
### Example 3 Add GatewayCustomBgpIpAddress to virtual network gateway connection
8975
```powershell
9076
$LocalnetGateway = Get-AzLocalNetworkGateway -ResourceGroupName "PS_testing" -name "testLng"
9177
$gateway = Get-AzVirtualNetworkGateway -ResourceGroupName PS_testing -ResourceName testGw
@@ -98,6 +84,32 @@ The two command gets a local network gateway and virtual network gateway.
9884
The third command creates a AzGatewayCustomBgpIpConfigurationObject.
9985
The third command creates this new virtual Network gateway connection with GatewayCustomBgpIpAddress.
10086

87+
### Example 4 Create a new virtual network gateway connection with certificate-based authentication
88+
```powershell
89+
$gateway = Get-AzVirtualNetworkGateway -ResourceGroupName "myResourceGroup" -Name "myVnetGateway"
90+
$localGateway = Get-AzLocalNetworkGateway -ResourceGroupName "myResourceGroup" -Name "myLocalGateway"
91+
92+
# Create certificate chain array with base64-encoded certificates (without headers/footers)
93+
$certChain = @(
94+
"MIIDfzCCAmegA...",
95+
"MIIDezCCAmOgA..."
96+
)
97+
98+
$certAuth = New-AzVirtualNetworkGatewayCertificateAuthentication `
99+
-OutboundAuthCertificate "https://myvault.vault.azure.net/certificates/mycert/abc123" `
100+
-InboundAuthCertificateSubjectName "CN=MyCertSubject" `
101+
-InboundAuthCertificateChain $certChain
102+
103+
New-AzVirtualNetworkGatewayConnection -Name "myCertConnection" -ResourceGroupName "myResourceGroup" -Location "eastus" `
104+
-VirtualNetworkGateway1 $gateway -LocalNetworkGateway2 $localGateway -ConnectionType IPsec `
105+
-AuthenticationType "Certificate" -CertificateAuthentication $certAuth
106+
```
107+
108+
This example creates a new virtual network gateway connection with certificate-based authentication.
109+
The first two commands get the virtual network gateway and local network gateway.
110+
The New-AzVirtualNetworkGatewayCertificateAuthentication cmdlet creates the certificate authentication configuration with the Key Vault certificate URL for outbound authentication, the certificate subject name for inbound authentication, and the certificate chain.
111+
The final command creates the new connection with certificate-based authentication instead of a pre-shared key.
112+
101113
## PARAMETERS
102114

103115
### -AsJob

src/Network/Network/help/Set-AzVirtualNetworkGateway.md

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ Set-AzVirtualNetworkGateway -VirtualNetworkGateway <PSVirtualNetworkGateway> [-G
2828
[-NatRule <PSVirtualNetworkGatewayNatRule[]>] [-BgpRouteTranslationForNat <Boolean>] [-MinScaleUnit <Int32>]
2929
[-MaxScaleUnit <Int32>] [-VirtualNetworkGatewayPolicyGroup <PSVirtualNetworkGatewayPolicyGroup[]>]
3030
[-ClientConnectionConfiguration <PSClientConnectionConfiguration[]>] [-AdminState <String>]
31-
[-AllowRemoteVnetTraffic <Boolean>] [-ResiliencyModel <String>] [-AllowVirtualWanTraffic <Boolean>] [-AsJob]
32-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
31+
[-AllowRemoteVnetTraffic <Boolean>] [-ResiliencyModel <String>] [-AllowVirtualWanTraffic <Boolean>]
32+
[-UserAssignedIdentityId <String>] [-Identity <PSManagedServiceIdentity>] [-AsJob]
33+
[-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
3334
[<CommonParameters>]
3435
```
3536

@@ -49,8 +50,9 @@ Set-AzVirtualNetworkGateway -VirtualNetworkGateway <PSVirtualNetworkGateway> [-G
4950
[-MaxScaleUnit <Int32>] [-VirtualNetworkGatewayPolicyGroup <PSVirtualNetworkGatewayPolicyGroup[]>]
5051
[-ClientConnectionConfiguration <PSClientConnectionConfiguration[]>] [-AdminState <String>]
5152
[-AllowRemoteVnetTraffic <Boolean>] [-ResiliencyModel <String>] [-AllowVirtualWanTraffic <Boolean>]
52-
-Tag <Hashtable> [-AsJob] [-DefaultProfile <IAzureContextContainer>]
53-
[-WhatIf] [-Confirm] [<CommonParameters>]
53+
[-UserAssignedIdentityId <String>] [-Identity <PSManagedServiceIdentity>] -Tag <Hashtable> [-AsJob]
54+
[-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
55+
[<CommonParameters>]
5456
```
5557

5658
## DESCRIPTION
@@ -522,6 +524,22 @@ Set-AzVirtualNetworkGateway -VirtualNetworkGateway $gateway -AllowRemoteVnetTraf
522524

523525
In both cases, the first command retrieves the gateway. You may then either modify the property directly on the object and persist it, or you may use the switch on the Set-AzVirtualNetworkGateway cmdlet.
524526

527+
### Example 13: Configure a virtual network gateway with a user-assigned managed identity
528+
529+
```powershell
530+
# Create or retrieve the user-assigned managed identity
531+
$identity = Get-AzUserAssignedIdentity -ResourceGroupName "resourceGroup001" -Name "myIdentity001"
532+
533+
# Get the virtual network gateway
534+
$gateway = Get-AzVirtualNetworkGateway -ResourceGroupName "resourceGroup001" -Name "gateway001"
535+
536+
# Set the identity using the UserAssignedIdentityId parameter
537+
Set-AzVirtualNetworkGateway -VirtualNetworkGateway $gateway -UserAssignedIdentityId $identity.Id
538+
539+
```
540+
541+
This example demonstrates how to configure a virtual network gateway with a user-assigned managed identity. This uses the UserAssignedIdentityId parameter to create the managed identity object. User-assigned identities are useful for accessing Azure Key Vault certificates for gateway authentication.
542+
525543
## PARAMETERS
526544

527545
### -AadAudienceId
@@ -781,6 +799,21 @@ Accept pipeline input: True (ByPropertyName)
781799
Accept wildcard characters: False
782800
```
783801
802+
### -Identity
803+
The managed identity configuration for the virtual network gateway.
804+
805+
```yaml
806+
Type: Microsoft.Azure.Commands.Network.Models.PSManagedServiceIdentity
807+
Parameter Sets: (All)
808+
Aliases:
809+
810+
Required: False
811+
Position: Named
812+
Default value: None
813+
Accept pipeline input: True (ByPropertyName)
814+
Accept wildcard characters: False
815+
```
816+
784817
### -IpConfigurationBgpPeeringAddresses
785818
The BgpPeeringAddresses for Virtual network gateway bgpsettings.
786819
@@ -856,6 +889,21 @@ Accept pipeline input: True (ByPropertyName)
856889
Accept wildcard characters: False
857890
```
858891
892+
### -ProgressAction
893+
{{ Fill ProgressAction Description }}
894+
895+
```yaml
896+
Type: System.Management.Automation.ActionPreference
897+
Parameter Sets: (All)
898+
Aliases: proga
899+
900+
Required: False
901+
Position: Named
902+
Default value: None
903+
Accept pipeline input: False
904+
Accept wildcard characters: False
905+
```
906+
859907
### -RadiusServerAddress
860908
P2S External Radius server address.
861909
@@ -946,6 +994,21 @@ Accept pipeline input: False
946994
Accept wildcard characters: False
947995
```
948996
997+
### -UserAssignedIdentityId
998+
ResourceId of the user assigned identity to be assigned to virtual network gateway.
999+
1000+
```yaml
1001+
Type: System.String
1002+
Parameter Sets: (All)
1003+
Aliases: UserAssignedIdentity
1004+
1005+
Required: False
1006+
Position: Named
1007+
Default value: None
1008+
Accept pipeline input: True (ByPropertyName)
1009+
Accept wildcard characters: False
1010+
```
1011+
9491012
### -VirtualNetworkGateway
9501013
The virtual network gateway object to base modifications off of.
9511014
This can be retrieved using Get-AzVirtualNetworkGateway

0 commit comments

Comments
 (0)