Get-AzBatchJob
取得 Batch 帳戶或作業排程的 Batch 作業。
語法
Get-AzBatchJob
[-JobScheduleId <String>]
[-Filter <String>]
[-MaxCount <Int32>]
[-Select <String>]
[-Expand <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzBatchJob
[[-Id] <String>]
[-Select <String>]
[-Expand <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzBatchJob
[[-JobSchedule] <PSCloudJobSchedule>]
[-Filter <String>]
[-MaxCount <Int32>]
[-Select <String>]
[-Expand <String>]
-BatchContext <BatchAccountContext>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Get-AzBatchJob Cmdlet 會取得由 BatchAccountContext 參數所指定之 Batch 帳戶的 Azure Batch 作業。 您可以使用 識別碼 參數來取得單一作業。 您可以使用 Filter 參數來取得符合開放式數據通訊協定 (OData) 篩選條件的作業。 如果您提供作業排程標識碼或 PSCloudJobSchedule 實例,此 Cmdlet 只會傳回該作業排程的作業。
範例
範例 1:依標識符取得 Batch 作業
Get-AzBatchJob -Id "Job01" -BatchContext $Context
CommonEnvironmentSettings :
Constraints : Microsoft.Azure.Commands.Batch.Models.PSJobConstraints
CreationTime : 7/25/2015 9:12:07 PM
DisplayName :
ETag : 0x8D29535B2941439
ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSJobExecutionInformation
Id : Job01
JobManagerTask :
JobPreparationTask :
JobReleaseTask :
LastModified : 7/25/2015 9:12:07 PM
Metadata :
PoolInformation : Microsoft.Azure.Commands.Batch.Models.PSPoolInformation
PreviousState :
PreviousStateTransitionTime :
Priority : 0
State : Active
StateTransitionTime : 7/25/2015 9:12:07 PM
Statistics :
Url : https://pfuller.westus.batch.azure.com/jobs/Job01
此命令會取得標識碼為Job01的作業。 使用 Get-AzBatchAccountKey Cmdlet 將內容指派給$Context變數。
範例 2:取得作業排程的所有使用中作業
Get-AzBatchJob -JobScheduleId "JobSchedule27" -Filter "state eq 'active'" -BatchContext $Context
CommonEnvironmentSettings :
Constraints : Microsoft.Azure.Commands.Batch.Models.PSJobConstraints
CreationTime : 7/25/2015 9:15:44 PM
DisplayName :
ETag : 0x8D2953633DD13E1
ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSJobExecutionInformation
Id : JobSchedule27:job-1
JobManagerTask :
JobPreparationTask :
JobReleaseTask :
LastModified : 7/25/2015 9:15:44 PM
Metadata :
PoolInformation : Microsoft.Azure.Commands.Batch.Models.PSPoolInformation
PreviousState :
PreviousStateTransitionTime :
Priority : 0
State : Active
StateTransitionTime : 7/25/2015 9:15:44 PM
Statistics :
Url : https://pfuller.westus.batch.azure.com/jobs/JobSchedule27:job-1
此命令會取得具有ID JobSchedule27 之作業排程的作用中作業。
範例 3:使用管線取得作業排程下的所有作業
Get-AzBatchJobSchedule -Id "JobSchedule27" -BatchContext $Context | Get-AzBatchJob -BatchContext $Context
CommonEnvironmentSettings :
Constraints : Microsoft.Azure.Commands.Batch.Models.PSJobConstraints
CreationTime : 7/25/2015 9:15:44 PM
DisplayName :
ETag : 0x8D2953633DD13E1
ExecutionInformation : Microsoft.Azure.Commands.Batch.Models.PSJobExecutionInformation
Id : JobSchedule27:job-1
JobManagerTask :
JobPreparationTask :
JobReleaseTask :
LastModified : 7/25/2015 9:15:44 PM
Metadata :
PoolInformation : Microsoft.Azure.Commands.Batch.Models.PSPoolInformation
PreviousState :
PreviousStateTransitionTime :
Priority : 0
State : Active
StateTransitionTime : 7/25/2015 9:15:44 PM
Statistics :
Url : https://pfuller.westus.batch.azure.com/jobs/JobSchedule27:job-1
此命令會使用 Get-AzBatchJobSchedule Cmdlet 取得標識符為 JobSchedule27 的作業排程。 命令會使用管線運算符,將該作業排程傳遞至目前的 Cmdlet。 命令會取得該作業排程的所有作業。
參數
-BatchContext
指定此 Cmdlet 用來與 Batch 服務互動的 BatchAccountContext 實例。 如果您使用 Get-AzBatchAccount Cmdlet 來取得 BatchAccountContext,則與 Batch 服務互動時,將會使用Microsoft Entra 驗證。 若要改用共用密鑰驗證,請使用 Get-AzBatchAccountKey Cmdlet 來取得已填入其存取金鑰的 BatchAccountContext 物件。 使用共用金鑰驗證時,預設會使用主要存取金鑰。 若要變更要使用的密鑰,請設定 BatchAccountContext.KeyInUse 屬性。
類型: | BatchAccountContext |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-DefaultProfile
用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶。
類型: | IAzureContextContainer |
別名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Expand
指定 Open Data Protocol (OData) expand 子句。 指定此參數的值,以取得您取得之主要實體的相關實體。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Filter
指定作業的 OData 篩選子句。 如果您未指定篩選條件,此 Cmdlet 會傳回 Batch 帳戶或作業排程的所有作業。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Id
指定此 Cmdlet 取得之作業的識別碼。 您無法指定通配符。
類型: | String |
Position: | 0 |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-JobSchedule
指定 PSCloudJobSchedule 物件,代表包含作業的作業排程。 若要取得 PSCloudJobSchedule 物件,請使用 Get-AzBatchJobSchedule Cmdlet。
類型: | PSCloudJobSchedule |
Position: | 0 |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
-JobScheduleId
指定包含作業之作業排程的識別碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | True |
接受萬用字元: | False |
-MaxCount
指定要傳回的作業數目上限。 如果您指定零 (0) 或更少值,Cmdlet 就不會使用上限。 預設值為 1000。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-Select
指定 OData select 子句。 指定此參數的值,以取得特定屬性,而不是所有物件屬性。
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |