How to assign Owner role of an Azure subscription to a particular user group (Azure AD Synced Group) using PowerShell

Hishan 71 Reputation points
2022-05-03T13:09:28.883+00:00

Hello Everyone,

This is very simple if you do it from Azure portal and infact I found an article from Microsoft explaining exactly how to do it.

Assign a user as an administrator of an Azure subscription

However I am struggling to write up a code to assign the Owner role of a particular subscription to an Azure AD Synced group. How do I do it using PowerShell?

Many thanks in advance.

Hishan

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,355 questions
0 comments No comments
{count} votes

Accepted answer
  1. Limitless Technology 39,336 Reputation points
    2022-05-04T07:46:36.973+00:00

    Hi Hishan-2429,

    This process should be pretty simple using Azure PowerShell commands such as:

    New-AzRoleAssignment -ObjectId <objectId> \-RoleDefinitionName <roleName>
    -Scope /subscriptions/<subscriptionId>/resourcegroups/<resourceGroupName>/providers/<providerName>/<resourceType>/<resourceSubType>/<resourceName>

    Here's a guide from Microsoft:

    https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-powershell

    --------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept as answer--


1 additional answer

Sort by: Most helpful
  1. Hishan 71 Reputation points
    2022-05-04T05:51:25.887+00:00
    0 comments No comments