Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update New-AzADUser.md #8212

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ Creates a new active directory user.
## SYNTAX

```
New-AzADUser -DisplayName <String> -UserPrincipalName <String> -Password <SecureString> [-ImmutableId <String>]
[-MailNickname <String>] [-ForceChangePasswordNextLogin] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
New-AzADUser -DisplayName <String> -UserPrincipalName <String> -Password <SecureString> -MailNickname <String> [-ImmutableId <String>] [-ForceChangePasswordNextLogin] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter is not required in the cmdlet code - are you sayign that it is actually required in some circumstances, or is this an oversight?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error if I do not provide it:

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use version 1.0.1:

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

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in that case, there is a coding issue, which will require more than a help fix - this cmdlet should be marked as required if it is actually required.

[-Confirm] [<CommonParameters>]
```

Expand All @@ -31,7 +30,7 @@ PS C:\> $SecureStringPassword = ConvertTo-SecureString -String "password" -AsPla
PS C:\> New-AzADUser -DisplayName "MyDisplayName" -UserPrincipalName "myemail@domain.com" -Password $SecureStringPassword -MailNickname "MyMailNickName"
```

Creates a new AD user with the name "MyDisplayName" and user principal name "myemail@domain.com" in a tenant.
Creates a new AD user with the name "MyDisplayName" and user principal name "MyMailNickName" in a tenant.

## PARAMETERS

Expand Down Expand Up @@ -98,14 +97,14 @@ Accept wildcard characters: False
```

### -MailNickname
The mail alias for the user.
The mail alias for the user. Cannot contain the @ sign.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Expand Down