Description
The default auto scale rule has no FixedDateEnd or FixedDateStart properties (eg. in Virtual Machine Scale Sets). But in the mentioned type in the current Az module (Microsoft.Azure.PowerShell.Cmdlets.Monitor.Autoscale.Models.Api20221001.AutoscaleProfile) these properties are not Nullables but ValueTypes.
Because of this they get the default value which is Monday, January 1, 0001 12:00:00 AM and it will be set on the resource, therefore it won't be default rule anymore.
Expectation: the type of the FixedDateEnd and FixedDateStart properties should be Nullable DateTime.
Repro steps:
- Create a Virtual Machine Scale Set in a new resource group
- Add default auto scale rule (this is the very first rule that you can add)
- Query the auto scale setting
- (optional) Edit the profile
- Update it with New-AzAutoscaleSetting cmdlet
- Check the scale rule on the portal
Issue script & Debug output
#script
$resourceGroup = ""
$setting = Get-AzAutoscaleSetting -ResourceGroupName $resourceGroup
Write-Host $setting.Profile[0].Name
Write-Host $setting.Profile[0].Rule[0].FixedDateStart
Write-Host $setting.Profile[0].Rule[0].FixedDateEnd
New-AzAutoscaleSetting -Name $setting.Name -ResourceGroupName $resourceGroup -Enabled -TargetResourceUri $setting.TargetResourceUri -Profile $setting.Profile -Location $setting.Location
#output
Auto created default scale condition
Monday, January 1, 0001 12:00:00 AM
Monday, January 1, 0001 12:00:00 AM
Environment data
Name Value
---- -----
PSVersion 5.1.22621.963
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.963
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Module versions
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 9.3.0 Az
Error output
No response
Description
The default auto scale rule has no FixedDateEnd or FixedDateStart properties (eg. in Virtual Machine Scale Sets). But in the mentioned type in the current Az module (Microsoft.Azure.PowerShell.Cmdlets.Monitor.Autoscale.Models.Api20221001.AutoscaleProfile) these properties are not Nullables but ValueTypes.
Because of this they get the default value which is Monday, January 1, 0001 12:00:00 AM and it will be set on the resource, therefore it won't be default rule anymore.
Expectation: the type of the FixedDateEnd and FixedDateStart properties should be Nullable DateTime.
Repro steps:
Issue script & Debug output
Environment data
Module versions
Error output
No response