Assign Owner role on multiple resources in azure?

Siva Poreddy 1 Reputation point

Hi All, I have 300+ resource groups in Azure and i want to assign Owner access to 250 resource groups. Individually I have to assign the owner access on each resource group is time consuming task. Is there is any other way to do this?

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
13,594 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
4,911 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Carlos Solís Salazar 11,046 Reputation points

    Thank you for asking this question on the Microsoft Q&A Platform.

    You can automate that task by creating a PowerShell script, for example:

    $RGs = "rg1", "rg2", "rg3"
    $USER = ""
    $RGs | ForEach-Object {
    New-AzRoleAssignment -ResourceGroupName $_ -SignInName $USER -RoleDefinitionName Owner -AllowDelegation

    With that script, you can assign the role of the Owner to multiple resources group to one user.

    More info about the command New-AzRoleAssignment

    Hope this helps!

    Accept Answer and Upvote, if any of the above helped, this thread can help others in the community looking for remediation for similar issues.

    NOTE: To answer you as quickly as possible, please mention me in your reply.