Assign Owner role on multiple resources in azure?

Siva Poreddy 1 Reputation point
2023-01-18T16:44:10.1133333+00:00

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,130 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,473 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Carlos Solís Salazar 16,531 Reputation points
    2023-01-18T16:59:22.28+00:00

    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 = "user@domain.com"
    $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.