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 Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,063 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,314 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Carlos Solís Salazar 16,351 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.

    1 person found this answer helpful.