手动模式最适合了解其 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-01-21",
"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
}
agent-profile或更新池时,通过 参数配置代理。
az mdp pool create \
--agent-profile agent-profile.json
# other parameters omitted for space
以下示例显示了 agent-profile.json 文件的内容。
手动备用代理预配在 resourcePredictionsProfile 参数的 agent-profile 部分中指定,详细信息在 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 项目。
{}
要计划单个备用代理从 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
}
手动备用代理预配在 resourcePredictionsProfile 的 agentProfile 部分中指定,详细信息在 resourcePredictions 部分中配置。
resource managedDevOpsPools 'Microsoft.DevOpsInfrastructure/pools@2025-01-21' = {
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-01-21",
"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-01-21' = {
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
}
{}
]
}
}
}
}