diff --git a/src/Resources/Resources/ChangeLog.md b/src/Resources/Resources/ChangeLog.md index a8b2bfa459ca..8d57df853447 100644 --- a/src/Resources/Resources/ChangeLog.md +++ b/src/Resources/Resources/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release +* Fixed NullReferenceException issue in `New-AzRoleAssignment` [#19793] ## Version 6.3.0 * Removed unused reference to resource identifier in role assignment create cmdlet diff --git a/src/Resources/Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs b/src/Resources/Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs index 7ea53e363cd7..1a2c032fa0f2 100644 --- a/src/Resources/Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs +++ b/src/Resources/Resources/RoleAssignments/NewAzureRoleAssignmentCommand.cs @@ -318,6 +318,13 @@ public override void ExecuteCmdlet() Id = ObjectId, ObjectType = ObjectType, }, + ResourceIdentifier = new ResourceIdentifier() { + ParentResource = ParentResource, + ResourceGroupName = ResourceGroupName, + ResourceName = ResourceName, + ResourceType = ResourceType, + Subscription = DefaultProfile.DefaultContext.Subscription.Id, + }, CanDelegate = AllowDelegation.IsPresent ? true : false, Description = Description, Condition = Condition,