Azure / Azure/azure-powershell
Update-AzAutoScaleSetting silently no-ops on Az.Monitor 8.0.0 due to internal CommandNotFoundException for Az.Autoscale.private\New-AzAutoscaleSetting_CreateViaIdentity
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
$setting = Get-AzAutoScaleSetting -ResourceGroupName -SubscriptionId
$profile = $setting.Profile
foreach ($p in $profile) {
$p.CapacityDefault = [int]$p.CapacityDefault + 1
$p.CapacityMinimum = [int]$p.CapacityMinimum + 1
}
Update-AzAutoScaleSetting -Name $setting.Name -ResourceGroupName -Profile $profile -SubscriptionId -ErrorAction Stop
Expected behavior: The autoscale setting's Profile.Capacity.Default/Minimum values are updated on the server, and/or the cmdlet returns the updated IAutoscaleSettingResource (per the [documented Outputs](https://learn.microsoft.com/powershell/module/az.monitor/update-azautoscalesetting)).
Actual behavior:
$? returns True, no exception is surfaced to the caller, and the cmdlet returns nothing ($null/empty).
Re-fetching the resource via Get-AzAutoScaleSetting afterward shows the Capacity values are unchanged — the update never actually reached the server.
-Debug output shows the request stops right after HeaderParametersAdded, before any request body containing capacity values is ever constructed.
Inspecting $Error[0] reveals a hidden, non-terminating internal error that is never surfaced to the caller:
Exception : System.Management.Automation.CommandNotFoundException: The term 'Az.Autoscale.private\New-AzAutoscaleSetting_CreateViaIdentity' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject : Az.Autoscale.private\New-AzAutoscaleSetting_CreateViaIdentity
CategoryInfo : ObjectNotFound: (Az.Autoscale.privat…g_CreateViaIdentity:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
Az.Autoscale is not a separately installable module (Install-Module Az.Autoscale returns "No match was found"), so this appears to be a missing/broken nested private module reference inside the Az.Monitor 8.0.0 package itself, not a missing dependency the end user can resolve.
The internal CommandNotFoundException is caught somewhere in the proxy cmdlet's call chain and never propagates as a terminating error — even with -ErrorAction Stop on the outer call — so the failure is completely silent to any calling script that checks $? or the cmdlet's return value.
Impact: Any automation that updates autoscale settings via Update-AzAutoScaleSetting on Az.Monitor 8.0.0 will silently fail to apply changes while appearing to succeed — a correctness/data-integrity issue, not just an inconvenience.
### Issue script & Debug output
```PowerShell
$setting = Get-AzAutoScaleSetting -ResourceGroupName -SubscriptionId
$profile = $setting.Profile
foreach ($p in $profile) {
$p.CapacityDefault = [int]$p.CapacityDefault + 1
$p.CapacityMinimum = [int]$p.CapacityMinimum + 1
}
Update-AzAutoScaleSetting -Name $setting.Name -ResourceGroupName -Profile $profile -SubscriptionId -ErrorAction Stop
```
### Environment data
```PowerShell
PowerShell: 7.6.3
OS: Windows 11 (tested in Windows Sandbox)
```
### Module versions
```PowerShell
Az.Accounts: 5.5.1
Az.Monitor: 8.0.0 (broken) — confirmed working on 6.0.3;
```
### Error output
```PowerShell
Exception : System.Management.Automation.CommandNotFoundException: The term 'Az.Autoscale.private\New-AzAutoscaleSetting_CreateViaIdentity' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject : Az.Autoscale.private\New-AzAutoscaleSetting_CreateViaIdentity
CategoryInfo : ObjectNotFound: (Az.Autoscale.privat…g_CreateViaIdentity:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
```
Contributor guide
Research direction
Start by reproducing the provided Update-AzAutoScaleSetting script with Az.Monitor 8.0.0 and inspect the proxy cmdlet's call to Az.Autoscale.private\New-AzAutoscaleSetting_CreateViaIdentity. Trace why the internal CommandNotFoundException is hidden, then verify that updating Profile capacity values reaches the server, returns the documented resource, or surfaces a failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100