< Back

Add-AzureRmVpnClientRootCertificate

Tue Jan 29, 2019 9:53 pm

NAME Add-AzureRmVpnClientRootCertificate



SYNOPSIS

Adds a VPN client root certificate.





SYNTAX

Add-AzureRmVpnClientRootCertificate [-DefaultProfile <IAzureContextContainer>] -PublicCertData <String> -ResourceGroupName <String>

-VirtualNetworkGatewayName <String> -VpnClientRootCertificateName <String> [<CommonParameters>]





DESCRIPTION

The Add-AzureRmVpnClientRootCertificate 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.





PARAMETERS

-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-PublicCertData <String>

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\\ExportedCertficate.cer"` `$CertificateText = for ($i=1; $i -lt $Text.Length -1 ; $i++){$Text[$i]}`



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>

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.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VirtualNetworkGatewayName <String>

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



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VpnClientRootCertificateName <String>

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



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Network.Models.PSVpnClientRootCertificate







NOTES









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



PS C:\\>$Text = Get-Content -Path "C:\\Azure\\Certificates\\ExportedCertficate.cer"

PS C:\\> $CertificateText = for ($i=1; $i -lt $Text.Length -1 ; $i++){$Text[$i]}

PS C:\\> Add-AzureRmVpnClientRootCertificate -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-AzureRmVpnClientRootCertificate cmdlet to add the root certificate to

the gateway.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ertificate

Get-AzureRmVpnClientRootCertificate

New-AzureRmVpnClientRootCertificate

Remove-AzureRmVpnClientRootCertificate