Currently there is no direct way to update look back period using Az PowerShell cmdlet. If interested, you may raise a feature request in this feedback or ideas portal. In general, Azure feature or product team would check feasibility of a feature request, prioritize against existing feature backlog, add in roadmap as appropriate and would announce and/or update the related Azure document once a feature request is addressed.
Until then as a workaround, you may try to update look back period using "duration" property of this REST API or using Invoke-RestMethod PowerShell cmdlet which basically sends an HTTP or HTTPS request to a RESTful web service. Please find below sample code for illustration purpose. You may have to tweak it to work in your environment. Currently I am facing 404 error if I execute it, so I am reaching out to our internal product team to confirm the same and see if we have any other workarounds for this. Will keep you updated as I hear more information.
$subscriptionId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$resourceGroup = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$actionGroupName = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$uri = "https://management.azure.com/subscriptions/$subscriptionId/providers/Microsoft.Advisor/configurations/default?api-version=2023-01-01"
$body = @{
properties = @{
lowCpuThreshold = "15"
duration = "60"
exclude = $true
digests = @(
@{
name = "digestConfigName"
actionGroupResourceId = "/subscriptions/subscriptionId/resourceGroups/$resourceGroup/providers/microsoft.insights/actionGroups/$actionGroupName"
frequency = 30
categories = @(
"HighAvailability",
"Security",
"Performance",
"Cost",
"OperationalExcellence"
)
language = "en"
state = "Active"
}
)
}
} | ConvertTo-Json
$auth = "eyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$authHeader = @{
'Content-Type'='application/json'
'Accept'='application/json'
'Authorization'= "Bearer $auth"
}
Invoke-RestMethod -Method PUT -Uri $uri -Body $body -Headers $authHeader