Remove-AzBatchTask
语法
Id
Remove-AzBatchTask
[-JobId] <String>
[-Id] <String>
-BatchContext <BatchAccountContext>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Remove-AzBatchTask
[-InputObject] <PSCloudTask>
-BatchContext <BatchAccountContext>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Remove-AzBatchTask cmdlet 删除 Azure Batch 任务。
除非指定 Force 参数,否则此 cmdlet 会提示你进行确认。
示例
示例 1:按 ID 删除批处理任务
Remove-AzBatchTask -JobId "Job-000001" -Id "Task23" -BatchContext $Context
此命令删除 ID 任务 23 下具有 ID 作业-000001 的任务。
该命令会提示你进行确认。
使用 Get-AzBatchAccountKey cmdlet 将上下文分配给$Context变量。
示例 2:使用管道删除批处理任务,而无需确认
Get-AzBatchTask -JobId "Job-000001" -Id "Task26" -BatchContext $Context | Remove-AzBatchTask -Force -BatchContext $Context
此命令使用 Get-AzBatchTask cmdlet 获取具有 ID 作业-000001 的作业中 ID 任务 26 的 Batch 任务。
该命令使用管道运算符将该任务传递到当前 cmdlet。
该命令将删除该任务。
此命令指定 Force 参数。
因此,该命令不会提示你进行确认。
参数
-BatchContext
指定此 cmdlet 用于与 Batch 服务交互的 BatchAccountContext 实例。
如果使用 Get-AzBatchAccount cmdlet 获取 BatchAccountContext,则在与 Batch 服务交互时将使用Microsoft Entra 身份验证。 若要改用共享密钥身份验证,请使用 Get-AzBatchAccountKey cmdlet 获取填充其访问密钥的 BatchAccountContext 对象。 使用共享密钥身份验证时,默认使用主访问密钥。 若要更改要使用的密钥,请设置 BatchAccountContext.KeyInUse 属性。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Force
强制命令运行而不要求用户确认。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Id
指定此 cmdlet 删除的任务的 ID。
不能指定通配符。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
Id
| Position: | 1 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
指定此 cmdlet 删除的任务。
若要获取 PSCloudTask 对象,请使用 Get-AzBatchTask cmdlet。
InputObject
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-JobId
指定包含任务的作业的 ID。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
Id
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | True |
| 来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。
命令脚本未运行。
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出