Recently, I was working with the New-AzRoleAssignment PowerShell command, After executing this command, I got this error New-azroleassignment : ‘principalid’ cannot be null.
Table of Contents
New-azroleassignment : ‘principalid’ cannot be null.
For one of the requirements, I have executed the PowerShell script below.
New-AzRoleAssignment -SignInName User2@tsinfotechnologies.onmicrosoft.com
-ResourceGroupName MyNewResGrp -RoleDefinitionName Contributor -AllowDelegationImmediately after executing the above script, I got this error, as shown in the below screenshot for your reference.

Solution
When I tried solving this error, I noticed that the SignInName “User2@tsinfotechnologies.onmicrosoft.com” doesn’t exist for me, so I got this error when I used another user that exists; I got the expected output as shown in the screenshot below. So, the main point here is to ensure that the user principal name you are using exists.
Now, I executed the same PowerShell script with the new user.
New-AzRoleAssignment -SignInName tsinfouser@fewlines4bijuhotmail.onmicrosoft.com -ResourceGroupName MyNewResGrp -RoleDefinitionName Contributor -AllowDelegationAfter executing the above script, I got the expected output successfully, as shown below.

You may also like the following articles below
- How To Add User To Azure Resource Group
- How To Give Access To Resource Group In Azure
- Get-AzRoleAssignment

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
