Back
You can use PowerShell to grant a user with a role of "Owner". Below is the command to do that:
#create userConnect-AzureAD$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile$PasswordProfile.Password = "Wdsr199545!"New-AzureADUser -DisplayName "test User" -PasswordProfile $PasswordProfile -UserPrincipalName "[email protected]" -AccountEnabled $true -MailNickName "testuser"#grant access Login-AzureRmAccount$sub = Get-AzureRmSubscription$scope = "/subscriptions/" + $sub.IdNew-AzureRmRoleAssignment -SignInName [email protected] -Scope $scope -RoleDefinitionName Owner
#create user
Connect-AzureAD
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = "Wdsr199545!"
New-AzureADUser -DisplayName "test User" -PasswordProfile $PasswordProfile -UserPrincipalName "[email protected]" -AccountEnabled $true -MailNickName "testuser"
#grant access
Login-AzureRmAccount
$sub = Get-AzureRmSubscription
$scope = "/subscriptions/" + $sub.Id
New-AzureRmRoleAssignment -SignInName [email protected] -Scope $scope -RoleDefinitionName Owner
I hope this will help.
Want to become an Azure expert? join azure architect certification now!!
Want to know more about Azure Active Directory? Watch this video on Azure Active Directory | Microsoft Azure Tutorial for Beginners:
31k questions
32.8k answers
501 comments
693 users