Edit

Share via


Add-AzVpnClientRootCertificate

Adds a VPN client root certificate.

Syntax

Default (Default)

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.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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\]}

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VirtualNetworkGatewayName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VpnClientRootCertificateName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceName

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Outputs

PSVpnClientRootCertificate