Open theheatDK opened 1 week ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @adana-popescu, @KalpeshChavan12, @ralucaminea.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @adana-popescu, @KalpeshChavan12, @ralucaminea.
Hi, I found the problem. If I call Get-AzMaintenanceConfiguration with an ResourceGroupName parameter it works, if I don't it fails.
Without the ResourceGroupName parameter is returns a List`1 and with a ResourceGroupName parameter is returns a PSMaintenanceConfiguration.
PS C:\> $MaintenanceConfig = Get-AzMaintenanceConfiguration -name 'aum-pelo01'
PS C:\> $MaintenanceConfig.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True List`1 System.Object
PS C:\> $MaintenanceConfig.count
1
PS C:\> Update-AzMaintenanceConfiguration -ResourceGroupName 'pelo-test' -Name 'aum-pelo01' -Configuration $MaintenanceConfig
Update-AzMaintenanceConfiguration: Cannot convert 'Microsoft.Azure.Commands.Maintenance.Models.PSMaintenanceConfiguration' to the type 'Microsoft.Azure.Commands.Maintenance.Models.PSMaintenanceConfiguration' required by parameter 'Configuration'. Specified method is not supported.
PS C:\>
PS C:\> $MaintenanceConfig = Get-AzMaintenanceConfiguration -name 'aum-pelo01' -ResourceGroupName 'pelo-test'
PS C:\> $MaintenanceConfig.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PSMaintenanceConfiguration System.Object
PS C:\> $MaintenanceConfig.count
1
PS C:\> Update-AzMaintenanceConfiguration -ResourceGroupName 'pelo-test' -Name 'aum-pelo01' -Configuration $MaintenanceConfig
Location : eastus2
Tags : {"ContactPerson":"PELO","CostCenter":"11096040","MacoTask":"Nfrst"}
ExtensionProperties : {"InGuestPatchMode":"User"}
MaintenanceScope : InGuestPatch
Id : /subscriptions/45fcd6a2-c6ba-4a15-b6ba-fcb3c93978aa/resourcegroups/pelo-test/providers/microsoft.maintenance/maintenanceconfigurations/aum-pelo
01
Name : aum-pelo01
Type : Microsoft.Maintenance/maintenanceConfigurations
StartDateTime : 2024-06-26 00:00
Duration : 03:55
Timezone : Romance Standard Time
Visibility : Custom
RecurEvery : 1Day
LinuxParameterClassificationToInclude : System.Collections.Generic.HashSet`1[System.String]
LinuxParameterPackageNameMaskToExclude : System.Collections.Generic.HashSet`1[System.String]
LinuxParameterPackageNameMaskToInclude : System.Collections.Generic.HashSet`1[System.String]
WindowParameterKbNumberToInclude : System.Collections.Generic.HashSet`1[System.String]
WindowParameterKbNumberToExclude : System.Collections.Generic.HashSet`1[System.String]
WindowParameterClassificationToInclude : System.Collections.Generic.HashSet`1[System.String]
InstallPatchRebootSetting : IfRequired```
That's probably it - source code
When there's no RG name the command lists all configurations, filter them, then put the results in a List then output. The solution is to call WriteObject()
multiple times, each time writing a configuration object, or to use the other overload WriteObject (object sendToPipeline, bool enumerateCollection)
to enumerate the list automatically.
Description
Hi, I cannot find any way of getting Update-AzMaintenanceConfiguration to work. I am using Az 12.0.0.
Here I get an existing configuration and send it to Update-AzMaintenanceConfiguration.
It always fail with: `Update-AzMaintenanceConfiguration: Cannot convert 'Microsoft.Azure.Commands.Maintenance.Models.PSMaintenanceConfiguration' to the type 'Microsoft.Azure.Commands.Maintenance.Models.PSMaintenanceConfiguration' required by parameter 'Configuration'. Specified method is not supported.
The same happens if I make a small change to a parameter:
Issue script & Debug output
Environment data
Module versions
Error output