Add-AzVpnClientRootCertificate

Adds a VPN client root certificate.

Syntax

Add-AzVpnClientRootCertificate
   -VpnClientRootCertificateName <String>
   -VirtualNetworkGatewayName <String>
   -ResourceGroupName <String>
   -PublicCertData <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Add-AzVpnClientRootCertificate cmdlet adds a root certificate to a virtual network gateway. Root certificates are X.509 certificates that identify your Root Certification Authority. By design, all certificates used on the gateway trust the root certificate. This cmdlet assigns an existing certificate as a gateway root certificate. If you do not have an X.509 certificate available you can generate one through your public key infrastructure or use a certificate generator such as makecert.exe. To add a root certificate, you must specify the certificate name and provide a text-only representation of the certificate (see the PublicCertData parameter for more information). Azure allows you to assign more than one root certificate to a gateway. Multiple root certificates are often deployed by organizations that include users from more than one company.

Examples

Example 1: Add a client root certificate to a virtual gateway

$Text = Get-Content -Path "C:\Azure\Certificates\ExportedCertificate.cer"
$CertificateText = for ($i=1; $i -lt $Text.Length -1 ; $i++){$Text[$i]}
Add-AzVpnClientRootCertificate -PublicCertData $CertificateText -ResourceGroupName "ContosoResourceGroup" -VirtualNetworkGatewayName "ContosoVirtualGateway" -VpnClientRootCertificateName "ContosoClientRootCertificate"

This example adds a client root certificate to a virtual gateway named ContosoVirtualGateway. The first command uses the Get-Content cmdlet to get a previously-exported text representation of the root certificate and stores that text data the variable named $Text. The second command then uses a for loop to extract all the text except for the first line and the last line. The extracted text is stored in a variable named $CertificateText. The third command then uses the text stored in $CertificateText with the Add-AzVpnClientRootCertificate cmdlet to add the root certificate to the gateway.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PublicCertData

Specifies the text representation of the root certificate to be added. To obtain the text representation, export your certificate in .cer format (using Base64 encoding), then open the resulting file in a text editor. When you do that, you will see output similar to the following (note that the actual output will contain many more lines of text than the abbreviated sample shown here): ----- BEGIN CERTIFICATE ----- MIIC13FAAXC3671Auij9HHgUNEW8343NMJklo09982CVVFAw8w ----- END CERTIFICATE ----- The PublicCertData is made up of all the lines between the first line (----- BEGIN CERTIFICATE -----) and the last line (----- END CERTIFICATE -----) in the file. You can retrieve this data by using Windows PowerShell commands similar to this: $Text = Get-Content -Path "C:\Azure\Certificates\ExportedCertificate.cer" $CertificateText = for ($i=1; $i -lt $Text.Length -1 ; $i++){$Text\[$i\]}

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

Specifies the name of the resource group that the root certificate is assigned to. Resource groups categorize items to help simplify inventory management and general Azure administration.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VirtualNetworkGatewayName

Specifies the name of the virtual network gateway where the certificate is added.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VpnClientRootCertificateName

Specifies the name of the client root certificate that this cmdlet adds.

Type:String
Aliases:ResourceName
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Outputs

PSVpnClientRootCertificate