An Azure service that provides a general-purpose, serverless container platform.
Hello @Brian Bento
You're looking in the right general area, but cooldownPeriod isn't actually a property of New AzContainerAppScaleRuleObject.
In the Azure Container Apps resource model, the structure is:
So cooldownPeriod applies to the Container App scaling configuration, not to an individual scaling rule. Microsoft currently documents it as an optional integer in seconds, with a default of 300 seconds when it isn't specified.
That's why you don't see a -CooldownPeriod parameter on:
New-AzContainerAppScaleRuleObject
Your $scaleRule construction is therefore only defining the rule itself:
$scaleRule = New-AzContainerAppScaleRuleObject `
-Name "http-scaling-rule" `
-CustomType "http" `
-CustomMetadata @{"concurrentRequests"="1"}
The problem is that the current New-AzContainerApp PowerShell parameter set you're using exposes things such as ScaleMinReplica, ScaleMaxReplica, and ScaleRule, but doesn't expose the complete underlying template.scale model, including cooldownPeriod.
The ARM resource schema does expose it:
"template": {
"scale": {
"minReplicas": 0,
"maxReplicas": 1,
"cooldownPeriod": 60,
"rules": [
...
]
}
}
Microsoft documents that schema here:
Microsoft.App/containerApps ARM/Bicep reference
So if the Az PowerShell cmdlet/version you're using doesn't expose ScaleCooldownPeriod, don't put it in CustomMetadata. That metadata belongs to the scaler itself and isn't where Container Apps expects the KEDA cooldown setting.
Instead, use the ARM/Bicep representation (or another deployment method that exposes the complete template.scale object) and set: properties.template.scale.cooldownPeriod
For example, in Bicep:
template: {
scale: {
minReplicas: 0
maxReplicas: 1
cooldownPeriod: 60
rules: [
// scaling rule
]
}
}
There is also a pollingInterval property at the same level if you need to control how frequently KEDA evaluates non-HTTP event sources; its documented default is 30 seconds.
So your assumption from the portal was correct: Cooldown Period belongs at the same logical scale level as Min Replicas and Max Replicas, not inside New-AzContainerAppScaleRuleObject. The confusing part is simply that the Az.ContainerApp PowerShell cmdlet doesn't necessarily expose every property available in the current Container Apps ARM schema.
If PowerShell is mandatory for your deployment pipeline, you can still deploy/update the ARM resource from PowerShell rather than relying exclusively on New-AzContainerApp's flattened parameters.
Help make this community better for everyone: If this answer helped or resolved your issue, please accept it or upvote it. If not, share more details in a comment so we can continue the discussion and find the right solution. Thank you.