共用方式為


Add-AzureWorkerRole

建立自定義背景工作角色的必要檔案和組態。

注意

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

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

語法

Add-AzureWorkerRole
   [-TemplateFolder <String>]
   [-Name <String>]
   [-Instances <Int32>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

本主題描述 Microsoft Azure PowerShell 模組 0.8.10 版本中的 Cmdlet。 若要取得您所使用的模組版本,請在 Azure PowerShell 控制台中輸入 (Get-Module -Name Azure).Version

Add-AzureWorkerRole Cmdlet 會建立自定義背景工作角色所需的檔案和組態,有時稱為 Scaffolding。

範例

範例 1:建立單一實例背景工作角色

PS C:\> Add-AzureWorkerRole -Name MyWorkerRole

本範例會將名為 MyWorkerRole 的單一背景工作角色 Scaffolding 新增至目前的應用程式。

範例 2:建立多個實例背景工作角色

PS C:\> Add-AzureWorkerRole MyWorkerRole -I 2

本範例會將名為 MyWorkerRole 的新背景工作角色 Scaffolding 新增至目前的應用程式,且角色實例計數為 2。

範例 3:使用自定義 Scaffolding 建立背景工作角色

PS C:\> Add-AzureWorkerRole MyWorkerRole -TemplateFoldr .\MyWorkerRoleTemplate

此範例會建立具有自定義 Scaffolding 的背景工作角色。

參數

-Instances

指定此背景工作角色的角色實例數目。 預設值是 1。

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

-Name

指定背景工作角色的名稱。 這個值會決定資料夾名稱,其中包含將裝載於背景工作角色之自定義應用程式的 Scaffolding。 默認值為 WorkerRolenumber,其中 number 是服務中的背景工作角色數目。

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

-Profile

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

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

-TemplateFolder

指定要用來建立背景工作角色的 Scaffolding 樣本資料夾。

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