Remove-AzVpnClientRootCertificate
語法
Default (預設值)
Remove-AzVpnClientRootCertificate
-VpnClientRootCertificateName <String>
-VirtualNetworkGatewayName <String>
-ResourceGroupName <String>
-PublicCertData <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
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 ----- MIIC13FAAXC3671Auij9HHgUNEW8343NMJklo09982CVVFAw8w ----- 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。
輸出