Skip to content

Instantly share code, notes, and snippets.

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

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