Skip to content

Instantly share code, notes, and snippets.

@nicolonsky
Last active January 9, 2019 12:13
Show Gist options
  • Save nicolonsky/becf40be21d4bdaf5c6f262df5a3d35c to your computer and use it in GitHub Desktop.
Save nicolonsky/becf40be21d4bdaf5c6f262df5a3d35c to your computer and use it in GitHub Desktop.
Connect-AzureAD
$runAsAccountServicePrincipal = Get-AzureADServicePrincipal -ObjectId "497421d0-5b78-4cf1-bab1-6ad2e3d7f319"
$accountAdminDirectoryRole= Get-AzureADDirectoryRole | where-object {$_.DisplayName -eq "User Account Administrator"}
Add-AzureADDirectoryRoleMember -ObjectId $accountAdminDirectoryRole.ObjectId `
-RefObjectId $runAsAccountServicePrincipal.ObjectId
Get-AzureADDirectoryRoleMember -ObjectId $accountAdminDirectoryRole.ObjectId
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment