New-AzBatchCertificate
將憑證新增至指定的 Batch 帳戶。
Syntax
New-AzBatchCertificate
[-FilePath] <String>
[-Password <SecureString>]
[-Kind <PSCertificateKind>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzBatchCertificate
[-RawData] <Byte[]>
[-Password <SecureString>]
[-Kind <PSCertificateKind>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
New-AzBatchCertificate Cmdlet 會將憑證新增至指定的 Azure Batch 帳戶。
範例
範例 1:從檔案新增憑證
New-AzBatchCertificate -FilePath "E:\Certificates\MyCert.cer" -BatchContext $Context
此命令會使用 E:\Certificates\MyCert.cer檔案,將憑證新增至指定的 Batch 帳戶。
範例 2:從原始數據新增憑證
$RawData = [System.IO.File]::ReadAllBytes("E:\Certificates\MyCert.pfx")
New-AzBatchCertificate -RawData $RawData -Password "Password1234" -BatchContext $Context
第一個命令會將名為 MyCert.pfx 的檔案中的數據讀入$RawData變數。 第二個命令會使用儲存在 $RawData 的原始數據,將憑證新增至指定的 Batch 帳戶。
參數
-BatchContext
指定 此 Cmdlet 用來與 Batch 服務互動的 BatchAccountContext 實例。 如果您使用 Get-AzBatchAccount Cmdlet 來取得 BatchAccountContext,則與 Batch 服務互動時,將會使用 Microsoft Entra 驗證。 若要改用共用密鑰驗證,請使用 Get-AzBatchAccountKey Cmdlet 來取得已填入其存取密鑰的 BatchAccountContext 物件。 使用共用金鑰驗證時,預設會使用主要存取金鑰。 若要變更要使用的密鑰,請設定 BatchAccountContext.KeyInUse 屬性。
Type: | BatchAccountContext |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-DefaultProfile
用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶。
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-FilePath
指定憑證檔案的路徑。 憑證檔案必須是 .cer 或 .pfx 格式。
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Kind
要建立的憑證種類。 如果未指定此專案,則會假設不含密碼的所有憑證都是 CER,且所有具有密碼的憑證都是 PFX。
Type: | PSCertificateKind |
Accepted values: | Cer, Pfx |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Password
指定要存取憑證私鑰的密碼。 如果您以 .pfx 格式指定憑證,則必須指定此參數。
Type: | SecureString |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RawData
以 .cer 或 .pfx 格式指定原始憑證數據。
Type: | Byte[] |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
輸入
Byte[]
輸出
相關連結
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應