< Back

Remove-AzureRmVpnClientRootCertificate

Tue Jan 29, 2019 9:57 pm

NAME Remove-AzureRmVpnClientRootCertificate



SYNOPSIS

Removes an existing VPN client root certificate.





SYNTAX

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

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





DESCRIPTION

The Remove-AzureRmVpnClientRootCertificate cmdlet removes the specified root certificate from a virtual network gateway. Root certificates are

X.509 certificates that identify your Root Certification Authority: all other certificates used on the gateway trust the root certificate. If you

remove a root certificate computers that use the certificate for authentication purposes will no longer be able to connect to the gateway.



When you use Remove-AzureRmVpnClientRootCertificate , you must supply both the certificate name and a text representation of the certificate data.

For more information about the text representation of a certificate see the PublicCertData parameter description.





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 removed. To obtain the text representation, export your certificate in .cer

format (using Base64) encoding, then open the resulting file in a text editor. You should 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 the PublicCertData 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 virtual network gateway 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 that the certificate is removed from.



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 removes.



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



NOTES









Example 1: Remove a client root certificate from a virtual network 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:\\> Remove-AzureRmVpnClientRootCertificate -PublicCertData $CertificateText -ResourceGroupName "ContosoResourceGroup"

-VirtualNetworkGatewayName "ContosoVirtualGateway"-VpnClientRootCertificateName "ContosoRootCertificate"



This example removes a client root certificate named ContosoRootCertificate from the virtual network gateway ContosoVirtualGateway.



The first command uses the Get-Content cmdlet to get a previously-exported text representation of the certificate; this text representation is

stored in a variable named $Text.



The second command then uses a for loop to extract all the text in $Text except for the first line and the last line. This extracted text is

stored in a variable named $CertificateText.



The third command uses the information stored in the $CertificateText variable along with the Remove-AzureRmVpnClientRootCertificate cmdlet to

remove the certificate from the gateway.







RELATED LINKS

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

Add-AzureRmVpnClientRootCertificate

Get-AzureRmVpnClientRootCertificate

New-AzureRmVpnClientRootCertificate