配置备用代理计划时,托管 DevOps 池会定期将预配代理计数与当前预配方案中指定的备用代理计数进行比较。 它根据需要启动新代理以保持备用代理的数量。 可以使用 “代理 ”窗格查看池中的代理的当前状态和计数。
手动模式最适合了解其持续集成和持续交付(CI/CD)管道使用模式的团队。 使用手动选项时,需要定义预预配方案。 根据你对池中最有可能使用的代理以及可能使用的代理数的理解来定义方案。 指定满足预计需求的代理的预配计数。
可以在 resourcePredictionsProfile 的 agentProfile 节中指定手动备用代理的预配。 可以在本节 resourcePredictions 中配置详细信息。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "fabrikam-managed-pool",
"type": "microsoft.devopsinfrastructure/pools",
"apiVersion": "2025-09-20",
"location": "eastus",
"properties": {
...
"agentProfile": {
"kind": "Stateless",
"resourcePredictionsProfile": {
"kind": "Manual"
},
"resourcePredictions": {
"timeZone": "Eastern Standard Time",
"daysData": [
{},
{
"00:00:00": 1,
"04:00:00": 0
},
{},
{},
{},
{},
{}
]
}
}
}
}
]
}
使用 timeZone 属性为方案指定所需的时区。 默认值为 UTC。 要检索此属性的时区名称列表,请参阅 TimeZoneInfo.GetSystemTimeZones 方法。
可以使用 daysData 列表定义备用代理人计划。 该 daysData 列表可以包含一个或七个项目。
包含七个项目的 daysData 列表对应一周中的天数,从星期日开始。 这七个项目中的每一项可以有零个或多个 "time": count 条目,以 24 小时格式指定时间,以及备用代理计数。 指定的备用代理的计数将一直保留到下一次"time": count条目,可能在同一天或次日。
daysData具有单个项的列表定义了一个全周方案,其中单个"time": count条目对应于整个星期的备用代理计数。
以下示例是手动备用代理方案。 它使用被配置的单个代理值 Eastern Standard Time,工作时间为星期一至星期五上午9:00(备用代理计数 1)到下午5:00(备用代理计数 0)。
{
"kind": "Stateless",
"resourcePredictions": {
"timeZone": "Eastern Standard Time",
"daysData": [
{},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{}
]
},
"resourcePredictionsProfile": {
"kind": "Manual"
}
}
单个 daysData 项目包含时间和备用代理计数的字典。 每个 "time" : count 条目以 24 小时格式指定要从指定时间开始计划的备用代理数。 连续的 "time" : count 条目指定当天的计划代理计数序列。
"daysData": [
{}, # Schedule of standby agent count adjustments for Sunday
{ # Schedule of standby agent count adjustments for Monday
"09:00:00": 1, # Adjust standby agent count to 1
"17:00:00": 0 # Adjust standby agent count to 0
},
{ # Schedule of standby agent count adjustments for Tuesday
"09:00:00": 1,
"17:00:00": 0
},
{ # Schedule of standby agent count adjustments for Wednesday
"09:00:00": 1,
"17:00:00": 0
},
{ # Schedule of standby agent count adjustments for Thursday
"09:00:00": 1,
"17:00:00": 0
},
{ # Schedule of standby agent count adjustments for Friday
"09:00:00": 1,
"17:00:00": 0
},
{} # Schedule of standby agent count adjustments for Saturday
]
备用代理计数不会在一天结束或一周结束时自动重置回零。 指定空 daysData 项不会停用当天的待命代理。 空的 daysData 项目意味着当天的备用代理计数计划没有更改。 要从特定时间段开始将备用代理设置为零,必须显式提供 "time" : count 为 count 的 0 条目。
示例
若要不调整在前一天结束时指定的备用代理计数(如果正在配置一周的第一个时间段),请指定一个 daysData 条目为零的项目:
{}
要计划单个备用代理在09:00:00启动和17:00:00停止(使用resourcePredictions属性指定的时区),请指定以下配置:
{
"09:00:00": 1,
"17:00:00": 0
}
若要从午夜至09:00:00安排单个备用代理,然后在17:00:00前安排10个备用代理,请指定以下配置:
{
"00:00:00": 1,
"09:00:00": 10,
"17:00:00": 0
}
要安排一个备用代理在指定日期的 09:00:00 启动,并在次日 17:00:00 停止,请使用两个连续的 daysData 项目:
{
"09:00:00": 1
},
{
"17:00:00": 0
}
可以在agent-profile或更新池时使用参数配置代理。
az mdp pool create \
--agent-profile agent-profile.json
# other parameters omitted for space
以下示例显示了 agent-profile.json 文件的内容。 可以在agent-profile参数的resourcePredictionsProfile部分指定手动配置备用代理程序。 配置 resourcePredictions 部分中的详细信息:
{
"Stateless": {},
"resourcePredictionsProfile": {
"Manual": {}
},
"resourcePredictions": {
"timeZone": "Eastern Standard Time",
"daysData": [
{},
{
"00:00:00": 1,
"04:00:00": 0
},
{},
{},
{},
{},
{}
]
}
}
使用 timeZone 属性指定方案的时区。 默认值为 UTC。 要检索此属性的时区名称列表,请参阅 TimeZoneInfo.GetSystemTimeZones 方法。
该 daysData 列表定义备用代理的计划。 该 daysData 列表可以包含一个或七个项目。
包含七个项目的 daysData 列表对应一周中的天数,从星期日开始。 这七个项目中的每一项可以有零个或多个 "time": count 条目,指定以24小时制表示的时间及备用代理的数量。 指定的备用代理数量将一直保持,直到下一个 "time": count 条目,该条目可以在同一天或之后的一天。
daysData具有单个项的列表定义了一个全周方案,其中单个"time": count条目对应于整个星期的备用代理计数。
以下示例是手动备用代理方案。 方案将该值 Eastern Standard Time 与星期一到星期五预配的单个代理一起使用,从上午 9:00(备用代理计数 1)到下午 5:00(备用代理计数 0):
{
"Stateless": {},
"resourcePredictionsProfile": {
"Manual": {}
},
"resourcePredictions": {
"timeZone": "Eastern Standard Time",
"daysData": [
{},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{
"09:00:00": 1,
"17:00:00": 0
},
{}
]
}
}
单个 daysData 项目包含时间和备用代理计数的字典。 每个 "time" : count 条目以 24 小时格式指定要从指定时间开始计划的备用代理数。 连续的 "time" : count 条目指定当天的计划代理计数序列。
"daysData": [
{}, # Schedule of standby agent count adjustments for Sunday
{ # Schedule of standby agent count adjustments for Monday
"09:00:00": 1, # Adjust standby agent count to 1
"17:00:00": 0 # Adjust standby agent count to 0
},
{ # Schedule of standby agent count adjustments for Tuesday
"09:00:00": 1,
"17:00:00": 0
},
{ # Schedule of standby agent count adjustments for Wednesday
"09:00:00": 1,
"17:00:00": 0
},
{ # Schedule of standby agent count adjustments for Thursday
"09:00:00": 1,
"17:00:00": 0
},
{ # Schedule of standby agent count adjustments for Friday
"09:00:00": 1,
"17:00:00": 0
},
{} # Schedule of standby agent count adjustments for Saturday
]
备用代理计数不会在一天结束或一周结束时自动重置回零。 指定空 daysData 项不会为当天禁用备用代理。 空的 daysData 项目意味着当天的备用代理计数计划没有更改。 要从特定时间段开始将备用代理设置为零,必须显式提供 "time" : count 为 count 的 0 条目。
示例
如果不想在前一天结束时调整指定的备用代理计数(如果正在配置一周的第一个时间段),请指定一个 daysData 条目为零的项目:
{}
若要计划单个备用代理以在指定的resourcePredictions属性时区启动09:00:00并停止17:00:00,请指定以下配置:
{
"09:00:00": 1,
"17:00:00": 0
}
若要安排一个备用代理从午夜开始运行直到 09:00:00,然后从 17:00:00开始再安排 10 个备用代理,指定以下配置:
{
"00:00:00": 1,
"09:00:00": 10,
"17:00:00": 0
}
要计划备用代理从指定日期的 09:00:00 开始可用,并在次日的 17:00:00 结束运行,请使用两个连续的 daysData 项:
{
"09:00:00": 1
},
{
"17:00:00": 0
}
可以在 resourcePredictionsProfile 的 agentProfile 节中指定手动备用代理的预配。 可以在 resourcePredictions 节中配置详细信息:
resource managedDevOpsPools 'Microsoft.DevOpsInfrastructure/pools@2025-09-20' = {
name: 'fabrikam-managed-pool'
location: 'eastus'
properties: {
...
agentProfile: {
kind: 'Stateless'
resourcePredictionsProfile: {
kind: 'Manual'
}
resourcePredictions: {
timeZone: 'Eastern Standard Time'
daysData: [
{}
{
'00:00:00': 1
'04:00:00': 0
}
{}
{}
{}
{}
{}
]
}
}
}
}
使用 timeZone 属性为方案指定所需的时区。 默认值为 UTC。 要检索此属性的时区名称列表,请参阅 TimeZoneInfo.GetSystemTimeZones 方法。
该 daysData 列表定义备用代理的计划。 该 daysData 列表可以包含一个或七个项目。
包含七个项目的 daysData 列表对应一周中的天数,从星期日开始。 这七个项目中的每一项可以有零个或多个 'time': count 条目,以 24 小时格式指定时间,以及备用代理计数。 指定的备用代理的计数将一直保留到下一次'time': count条目,可能在同一天或次日。
daysData具有单个项的列表定义了一个全周方案,其中单个'time': count条目对应于整个星期的备用代理计数。
以下示例是一个手动预备代理方案,使用值 Eastern Standard Time,单个代理在周一至周五期间预配,从上午9:00(备用代理计数 1)至下午5:00(备用代理计数 0):
{
kind: 'Stateless'
resourcePredictions: {
timeZone: 'Eastern Standard Time'
daysData: [
{}
{
'09:00:00': 1
'17:00:00': 0
}
{
'09:00:00': 1
'17:00:00': 0
}
{
'09:00:00': 1
'17:00:00': 0
}
{
'09:00:00': 1
'17:00:00': 0
}
{
'09:00:00': 1
'17:00:00': 0
}
{}
]
}
resourcePredictionsProfile: {
kind: 'Manual'
}
}
单个 daysData 项目包含时间和备用代理计数的字典。 每个 'time' : count 条目以 24 小时格式指定要从指定时间开始计划的备用代理数。 连续的 'time' : count 条目指定当天的计划代理计数序列。
daysData: [
{} // Schedule of standby agent count adjustments for Sunday
{ // Schedule of standby agent count adjustments for Monday
'09:00:00': 1 // Adjust standby agent count to 1
'17:00:00': 0 // Adjust standby agent count to 0
}
{ // Schedule of standby agent count adjustments for Tuesday
'09:00:00': 1
'17:00:00': 0
}
{ // Schedule of standby agent count adjustments for Wednesday
'09:00:00': 1
'17:00:00': 0
}
{ // Schedule of standby agent count adjustments for Thursday
'09:00:00': 1
'17:00:00': 0
}
{ // Schedule of standby agent count adjustments for Friday
'09:00:00': 1
'17:00:00': 0
}
{} // Schedule of standby agent count adjustments for Saturday
]
备用代理计数不会在一天结束或一周结束时自动重置回零,并且指定空 daysData 项不会禁用当天的备用代理。 空的 daysData 项目意味着当天的备用代理计数计划没有更改。 要从特定时间段开始将备用代理设置为零,必须显式提供 "time" : count 为 count 的 0 条目。
示例
若不调整前一天结束时指定的备用代理计数(如果您正在配置一周的第一个时间段),请指定一个daysData项,其条目数为零。
{}
若要计划单个备用代理以在09:00:00启动并在17:00:00停止(使用resourcePredictions属性中指定的时区),请进行以下配置:
{
'09:00:00': 1
'17:00:00': 0
}
若要安排一个备用代理从午夜开始工作直到09:00:00,然后安排 10 个备用代理继续工作直到17:00:00,请指定以下配置:
{
'00:00:00': 1
'09:00:00': 10
'17:00:00': 0
}
若要计划从指定日期开始 09:00:00 可用的备用代理,并在第二天停止 17:00:00 ,请使用两个连续 daysData 项:
{
'09:00:00': 1
}
{
'17:00:00': 0
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "fabrikam-managed-pool",
"type": "microsoft.devopsinfrastructure/pools",
"apiVersion": "2025-09-20",
"location": "eastus",
"properties": {
...
"agentProfile": {
"kind": "Stateless",
"resourcePredictionsProfile": {
"kind": "Manual"
},
"resourcePredictions": {
"timeZone": "Eastern Standard Time",
"daysData": [
{},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{}
]
}
}
}
}
]
}
{
"Stateless": {},
"resourcePredictionsProfile": {
"Manual": {}
},
"resourcePredictions": {
"timeZone": "Eastern Standard Time",
"daysData": [
{},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{
"09:00:00": 4,
"17:00:00": 0
},
{}
]
}
}
resource managedDevOpsPools 'Microsoft.DevOpsInfrastructure/pools@2025-09-20' = {
name: 'fabrikam-managed-pool'
location: 'eastus'
properties: {
...
agentProfile: {
kind: 'Stateless'
resourcePredictionsProfile: {
kind: 'Manual'
}
resourcePredictions: {
timeZone: 'Eastern Standard Time'
daysData: [
{}
{
'09:00:00': 4
'17:00:00': 0
}
{
'09:00:00': 4
'17:00:00': 0
}
{
'09:00:00': 4
'17:00:00': 0
}
{
'09:00:00': 4
'17:00:00': 0
}
{
'09:00:00': 4
'17:00:00': 0
}
{}
]
}
}
}
}