While assigning dynamic scope resource type error

sns 9,226 Reputation points
2023-11-26T15:11:50.27+00:00

I executed following 2 commands:

1.

$mc=Get-AZMaintenanceConfiguration -ResourceGroupName Ue2PrD01ResourceGroup -Name Dr01MainteanceConfig

1.

New-AzConfigurationAssignment -ConfigurationAssignmentName $mc.Name -MaintenanceConfigurationId $mc.Id -FilterLocation eastus2 -FilterOsType Windows -FilterTag '{"EnvironmentCode" : ["Dev01"] }' '{"EnvironmentType" : ["Development"] }' '{"Team" : ["DCloud Raiders test@gmail.com"] }'

Error: I see after debug

User's image

Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
259 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Dillon Silzer 54,836 Reputation points
    2023-11-26T19:33:09.3233333+00:00

    Hi sns,

    As stated in the error, 'resourceType' cannot be null. Here is an example with resourceType:

    New-AzConfigurationAssignment -ResourceGroupName smdtest$location -ResourceParentType hostGroups -ResourceParentName smddhg$location -ResourceType hosts -ResourceName smddh$location -ProviderName Microsoft.Compute -ConfigurationAssignmentName $maintenanceConfigurationName -MaintenanceConfigurationId $maintenanceConfigurationCreated.Id -Location $location
    

    https://learn.microsoft.com/en-us/powershell/module/az.maintenance/new-azconfigurationassignment?view=azps-11.0.0#example-1

    User's image


    If this is helpful please accept answer.


  2. Monalla-MSFT 12,281 Reputation points
    2023-12-07T15:43:04.8966667+00:00

    @sns - Thanks for reaching out to us.

    I see that you have posted a similar question here: https://learn.microsoft.com/en-us/answers/questions/1437305/resource-type-cant-be-null, reposting the solution here for the broader community here.

    ResourceType is optional since 1.3.1 release, before this version it was mandatory. Please ensure to use only 1 PS module version.

    Hope this helps. and please feel free to reach out if you have any further questions.


    Please don't forget to "Accept as Answer" and click "Yes" if the above response is helpful, so it can be beneficial to the community.

    0 comments No comments