Skip to content

New-AzADUser requires -MailNickname but parameter is not required #8220

Closed

Description

Description

New-AzADUser throws when -MailNickname is not provided, but the parameter is not required. Not sure if this parameter should be required or if there is some other issue with the cmdlet code.
PR where this issue was discovered: https://github.com/Azure/azure-powershell/pull/8212/files

Script/Steps for Reproduction

PS C:\svn\obs\azure\scripts> $SecureStringPassword = ConvertTo-SecureString -String "TxQl77FS*#m9" -AsPlainText -Force
New-AzADUser -DisplayName "dnhf01-test01" -UserPrincipalName "dnhf01-test03@xyz.onmicrosoft.com" -Password $SecureStringPassword
New-AzADUser : 'MailNickname' cannot be null.
At line:2 char:1
+ New-AzADUser -DisplayName "dnhf01-test01" -UserPrincipalName "dnhf01- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzADUser], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.NewAzureADUserCommand

Module Version

PS C:\svn\obs\azure\scripts> Get-Module Az

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.1      Az

Environment Data

$PSVersionTable

Debug Output


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions