Remove-AzVpnClientRootCertificate
语法
Default (默认值)
Remove-AzVpnClientRootCertificate
-VpnClientRootCertificateName <String>
-VirtualNetworkGatewayName <String>
-ResourceGroupName <String>
-PublicCertData <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
Remove-AzVpnClientRootCertificate cmdlet 从虚拟网络网关中删除指定的根证书。
根证书是标识根证书颁发机构的 X.509 证书:网关上使用的所有其他证书都信任根证书。
如果删除了使用证书进行身份验证的根证书计算机,将无法再连接到网关。
使用 Remove-AzVpnClientRootCertificate 时,必须同时提供证书名称和证书数据的文本表示形式。
有关证书的文本表示形式的详细信息,请参阅 PublicCertData 参数说明。
示例
示例 1:从虚拟网络网关中删除客户端根证书
$Text = Get-Content -Path "C:\Azure\Certificates\ExportedCertificate.cer"
$CertificateText = for ($i=1; $i -lt $Text.Length -1 ; $i++){$Text[$i]}
Remove-AzVpnClientRootCertificate -PublicCertData $CertificateText -ResourceGroupName "ContosoResourceGroup" -VirtualNetworkGatewayName "ContosoVirtualGateway" -VpnClientRootCertificateName "ContosoRootCertificate"
此示例从虚拟网络网关 ContosoVirtualGateway 中删除名为 ContosoRootCertificate 的客户端根证书。
第一个命令使用 Get-Content cmdlet 获取以前导出的证书文本表示形式;此文本表示形式存储在名为$Text的变量中。
然后,第二个命令使用 for 循环提取除第一行和最后一行之外$Text中的所有文本。
此提取的文本存储在名为$CertificateText的变量中。
第三个命令使用存储在 $CertificateText 变量中的信息以及 Remove-AzVpnClientRootCertificate cmdlet 从网关中删除证书。
参数
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-PublicCertData
指定要删除的根证书的文本表示形式。
若要获取文本表示形式,请以.cer格式(使用 Base64)编码导出证书,然后在文本编辑器中打开生成的文件。
应会看到类似于以下内容的输出(请注意,实际输出将包含比此处所示的缩写示例更多的文本行):----- BEGIN CERTIFICATE ----- MIIC13FAAXC3671Auij9HHhgUNEW8343NMJklo09982CVVFAw8w ----- END CERTIFICATE ----- PublicCertData 由第一行(----- BEGIN CERTIFICATE -----)和文件中最后一行(----- END CERTIFICATE -----)之间的所有行组成。
可以使用如下所示的 Windows PowerShell 命令检索 PublicCertData:$Text = Get-Content -Path“C:\Azure\Certificates\ExportedCertificate.cer” $CertificateText = for ($i=1; $i -lt $Text.Length -1; $i++){$Text[$i]}
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-ResourceGroupName
指定虚拟网络网关分配到的资源组的名称。
资源组对项进行分类,以帮助简化库存管理和常规 Azure 管理。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-VirtualNetworkGatewayName
指定从中删除证书的虚拟网络网关的名称。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-VpnClientRootCertificateName
指定此 cmdlet 删除的客户端根证书的名称。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
| 别名: | 资源名称 |
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出