Skip to content

Object reference not set to an instance of an object on New-AzureADMSInvitation #24

@Xentraxx

Description

@Xentraxx

Hello everyone,
this is my command:
New-AzureADMSInvitation -InvitedUserEmailAddress $email -SendInvitationMessage $false -InviteRedirectUrl "https://example.com" -InvitedUserDisplayName "$lastname, $firstname"
The variables are all initialized.
Nevertheless I am getting the following error:

New-AzureADMSInvitation : Object reference not set to an instance of an object.
At C:\Users\attenbej\Desktop\inviteUsersToAAD.ps1:84 char:9
+         New-AzureADMSInvitation -InvitedUserEmailAddress $email -Send ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureADMSInvitation], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Open.MSGraphV10.PowerShell.NewAzureADMSInvitation

Could you please look into that, as I am pretty sure that my command is correct.
$PSVersionTable.PSVersion shows:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  1490

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions