1

I'm trying to use the Azure AD PowerShell to generate an invite link. I'm using the New-AzureADMSInvitation method (https://learn.microsoft.com/en-us/powershell/module/azuread/new-azureadmsinvitation?view=azureadps-2.0).

I run it in the cloud shell and get the following error:

PS Azure:\> New-AzureADMSInvitation

cmdlet New-AzureADMSInvitation at command pipeline position 1
Supply values for the following parameters:
InvitedUserEmailAddress: "**@**.com"
InviteRedirectUrl: "**.com"
New-AzureADMSInvitation : Object reference not set to an instance of an object.
At line:1 char:1
+ New-AzureADMSInvitation
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureADMSInvitation], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Open.MSGraphV10.PowerShell.NewAzureADMSInvitation

I've tried restarting the shell, not including the quotes in the inputs, but no luck. Anyone able to get around this?

rsahai91
  • 437
  • 4
  • 13
  • Are you able to run this in your own machine instead of cloud shell? – Andre Teixeira Mar 14 '18 at 23:23
  • I used the cloud shell because I don't have a windows machine. I tried the OSx and Linux PowerShell installs before using the cloud shell, but they didn't have the New-AzureADMSInvitiation functionality. Looks like I'll need to track down a windows OS or use a VM, thanks for the help. – rsahai91 Mar 15 '18 at 17:49

1 Answers1

1

It seems like we cannot use this command in Cloud Shell (Powershell). I also suggest you can post your idea in this Feedback Forum. Azure Team will review it.

Also, you can try to use this powershell command on your local machine . Ensure you have used AAD Powershell 2.0 or later.

Just try to Enter the following powershell scripts:

New-AzureADMSInvitation -InvitedUserEmailAddress <guest user's EmailAddress> -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.onmicrosoft.com"

Hope this helps!

Wayne Yang
  • 9,016
  • 2
  • 20
  • 40