共用方式為


Add-AzureCertificate

將憑證上傳至 Azure 雲端服務。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

重要

針對新客戶目前已取代 Azure 雲端服務 (傳統),而針對所有客戶,該服務將從 2024 年 8 月 31 日起完全淘汰。 新部署應該使用 Azure Resource Manager 型的新部署模型 Azure 雲端服務 (延伸支援)

語法

Add-AzureCertificate
   [-ServiceName] <String>
   [-CertToDeploy] <Object>
   [-Password <String>]
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

Add-AzureCertificate Cmdlet 會上傳 Azure 服務的憑證。

範例

範例 1:上傳憑證和密碼

PS C:\> Add-AzureCertificate -ServiceName "ContosoService" -CertToDeploy ContosoCertificate.pfx -Password "password"

此命令會將憑證檔案 ContosoCertificate.pfx 上傳至雲端服務。 命令會指定憑證的密碼。

範例 2:上傳憑證檔案

PS C:\> Add-AzureCertificate -serviceName "MyService" -CertToDeploy ContosoCertificate.cer

此命令會將憑證檔案ContosoCertificate.cer上傳至雲端服務。 命令會指定憑證的密碼。

範例 3:上傳憑證物件

PS C:\> $Certificate = Get-Item cert:\PATTIFULLER\MY\1D6E34B526723E06C235BE8E5457784BF12C9F39
PS C:\> Add-AzureCertificate -ServiceName "ContosoService" -CertToDeploy $Certificate

第一個命令會使用 Windows PowerShell 核心 Get-Item Cmdlet,從使用者的 MY 存放區取得憑證。 命令會將憑證儲存在 $Certificate 變數中。

第二個命令會將 $certificate 中的憑證上傳至雲端服務。

參數

-CertToDeploy

指定要部署的憑證。 您可以指定憑證檔案的完整路徑,例如具有 *.cer 或 *的檔案。 pfx 擴展名或 X.509 Certificate 物件。

類型:Object
Position:1
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-InformationAction

指定此 Cmdlet 如何回應資訊事件。

此參數可接受的值為:

  • 繼續
  • 忽略
  • 詢問
  • SilentlyContinue
  • 停止
  • 暫止
類型:ActionPreference
別名:infa
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InformationVariable

指定資訊變數。

類型:String
別名:iv
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Password

指定憑證密碼。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ServiceName

指定此 Cmdlet 新增憑證的 Azure 服務名稱。

類型:String
Position:0
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

輸出

ManagementOperationContext