共用方式為


New-AzureAutomationCertificate

建立 Azure 自動化 憑證。

注意

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

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

語法

New-AzureAutomationCertificate
   -Name <String>
   [-Description <String>]
   [-Password <SecureString>]
   -Path <String>
   [-Exportable]
   -AutomationAccountName <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

重要

自 2020 年 01 月 23 日起,支援 Azure 自動化 的 PowerShell 命令。 Azure 服務管理模型已被取代為 Azure 自動化,並在該日期停用。 請使用在 Az.Automation支援 Azure 資源管理模型的命令。

New-AzureAutomationCertificate Cmdlet 會在 Microsoft Azure 自動化中建立憑證。 您可以提供要上傳之憑證檔案的路徑。

範例

範例 1:建立憑證

PS C:\> $password = ConvertTo-SecureString "PassWord!" -AsPlainText -Force
PS C:\> New-AzureAutomationCertificate -AutomationAccountName "Contoso17" -Name "MyCertificate" -Path "./cert.pfx" -Password $password

這些命令會在名為 MyCertificate 的 Azure 自動化 中建立憑證。 第一個命令會為建立憑證的第二個命令中使用的憑證檔案建立密碼。

參數

-AutomationAccountName

指定將儲存憑證的自動化帳戶名稱。

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

-Description

指定憑證的描述。

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

-Exportable

表示可以導出憑證。

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

-Name

指定憑證的名稱。

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

-Password

指定憑證檔案的密碼。

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

-Path

指定要上傳之腳本檔案的路徑。 檔案可以是 .cer 或 .pfx。

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

-Profile

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

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

輸出

CertificateInfo