Skip to content

New-MgUser fails when SurName is providedΒ #3178

@forfe15

Description

@forfe15

Using New-MgUser fails with the error when the parameter -SurName has a value:

Resource '' does not exist or one of its queried reference-property objects are not present.
Status: 404 (NotFound)
ErrorCode: Request_ResourceNotFound.....

The error doesn't state the actual issue and doesn't mention the parameter.

Microsoft Graph version 2.26.0

Tested on two different devices.

Test code:

$PasswordProfile = @{
    Password = "whatever!12"
    forceChangePasswordNextSignIn = $false
    ForceChangePasswordNextSignInWithMfa = $false
}

New-MgUser -DisplayName 'Test DELETE' -GivenName "Test" -SurName "DELETE" -PasswordProfile $PasswordProfile -AccountEnabled -MailNickName 'Test-Delete' -UserPrincipalName '[email protected]'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions