How to setup Update Manager dynamic scope via Azure PowerShell?

sac16 75 Reputation points
2023-10-26T21:37:42.5933333+00:00

I am trying to setup dynamic scopes (multiple subscriptions filtering on a specific tag value) to a new maintenance configuration in Azure Update Manager. It can be done through the portal (see screenshot), but I need to be able to do it via Azure PowerShell script because these need to be created on a mass scale.

The New-AzConfigurationAssignment cmdlet is supposed to be able to setup dynamic scopes, but it doesn't seem to be able to do this by subscriptions. Is this possible or is there another cmdlet used to do this?

User's image

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,873 questions
Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
304 questions
0 comments No comments
{count} votes

Accepted answer
  1. kobulloc-MSFT 26,321 Reputation points Microsoft Employee
    2023-10-27T06:37:38.23+00:00

    Hello, @sac16 !

    How do I enable Dynamic Scoping across multiple subscriptions with a PowerShell script?

    Dynamic Scoping allows you to group machines based on criteria such as subscription, resource group, location, resource type, OS Type, and Tags. In the documentation for New-AzConfigurationAssignment, I see a -Filter for everything mentioned above except subscriptions (with the only mention of subscriptions being under -DefaultProfile).

    If we look at the Azure CLI equivalent, az maintenance assignment, create-or-update-subscription has a parameter for --subscription. I would recommend using the Azure CLI command in this instance for your PowerShell script.

    https://video2.skills-academy.com/en-us/cli/azure/maintenance/assignment?view=azure-cli-latest#az-maintenance-assignment-create-or-update-subscription

    If you need another solution, please let us know in the comments and we would be happy to help.


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers.

    If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!

    User's image

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.