Skip to content

Instantly share code, notes, and snippets.

@JustinGrote
Last active Oct 22, 2021
Embed
What would you like to do?
Better Example of using classes
using namespace Microsoft.Graph.PowerShell.Models
[MicrosoftGraphUser1]@{
DisplayName = 'Some User'
UserPrincipalName = 'someuser@mycompany.com'
MailNickname = 'someuser@mycompany.com'
AccountEnabled = $true
PasswordProfile = [MicrosoftGraphPasswordProfile]@{
Password = 'Pass@word1'
}
} | New-MgUser
@JustinGrote

This comment has been minimized.

Copy link
Owner Author

@JustinGrote JustinGrote commented Oct 22, 2021

The pipeline works simply because -BodyParameter accepts pipeline input by Value, and since it is typed, it is easy to discover over the other parameter sets.

    -BodyParameter <IMicrosoftGraphUser1>
        Represents an Azure Active Directory user object.
        To construct, see NOTES section for BODYPARAMETER properties and create a hash table.

        Required?                    true
        Position?                    named
        Default value
        Accept pipeline input?       true (ByValue)
        Accept wildcard characters?  false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment