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

[MSGraph] add new parameter set to new-azaduser, fix issues with get-azaduser #19337

Merged
merged 4 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
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
@@ -1,6 +1,6 @@
---
Module Name: Az.Authorization
Module Guid: 7410e7c8-1228-4519-b21e-ede757f80297
Module Guid: 9a7f9619-b38e-4642-a74d-2298096962a0
Download Help Link: https://docs.microsoft.com/powershell/module/az.authorization
Help Version: 1.0.0.0
Locale: en-US
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/Authorization.Autorest/generate-info.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"node": "v14.15.5",
"autorest_core": "3.8.4",
"autorest_modelerfour": "4.15.414",
"autorest_powershell": "3.0.492",
"autorest_powershell": "3.0.494",
"swagger_commit": "6b08774c89877269e73e11ac3ecbd1bd4e14f5a0",
"autorest": "`-- (empty)",
"swagger_commit": "8c3029730778c35b597aa6d1afe69e78872bf03c"
"autorest_modelerfour": "4.15.414",
"autorest_core": "3.9.2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected override void ProcessRecord()

if (previewVersion != null)
{
sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}");
sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = '{previewVersion}'");
}
sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule Authorization".Split(' ').ToPsList().NullIfEmpty() ?? "''"}");
sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'");
Expand Down
28 changes: 28 additions & 0 deletions src/Resources/MSGraph.Autorest/Az.MSGraph.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,34 @@
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphEmployeeOrgData</Name>
<ViewSelectedBy>
<TypeName>Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphEmployeeOrgData</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>CostCenter</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Division</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>CostCenter</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Division</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphEndpoint</Name>
<ViewSelectedBy>
Expand Down
6 changes: 6 additions & 0 deletions src/Resources/MSGraph.Autorest/custom/Get-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ function Get-AzADUser {
[System.String[]]
# Select properties to be returned
${Select},

[Parameter(ParameterSetName='List')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Query')]
[System.Management.Automation.SwitchParameter]
# Include count of items
${Count},

[Parameter(ParameterSetName='List')]
[Parameter(ParameterSetName='StartsWithParameterSet')]
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/MSGraph.Autorest/custom/New-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ https://docs.microsoft.com/powershell/module/az.resources/new-azaduser
#>
function New-AzADUser {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphUser])]
[CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
[CmdletBinding(DefaultParameterSetName='WithPassword', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
Expand Down Expand Up @@ -273,7 +273,7 @@ param(
# The two may be specified together; for example: DisablePasswordExpiration, DisableStrongPassword.Supports $filter (ne, NOT).
${PasswordPolicy},

[Parameter()]
[Parameter(ParameterSetName="WithPasswordProfile", Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile]
# passwordProfile
Expand Down Expand Up @@ -391,12 +391,12 @@ param(
# Supports $filter (eq, ne, NOT, in,).
${UserType},

[Parameter(Mandatory)]
[Parameter(ParameterSetName="WithPassword", Mandatory)]
[SecureString]
# Password for the user. It must meet the tenant's password complexity requirements. It is recommended to set a strong password.
${Password},

[Parameter()]
[Parameter(ParameterSetName="WithPassword")]
[System.Management.Automation.SwitchParameter]
# It must be specified if the user must change the password on the next successful login (true). Default behavior is (false) to not change the password on the next successful login.
${ForceChangePasswordNextLogin},
Expand Down
21 changes: 18 additions & 3 deletions src/Resources/MSGraph.Autorest/docs/Get-AzADUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Lists entities from users or get entity from users by key

### List (Default)
```
Get-AzADUser [-AppendSelected] [-ConsistencyLevel <String>] [-DefaultProfile <PSObject>] [-Expand <String[]>]
[-Filter <String>] [-First <UInt64>] [-Orderby <String[]>] [-Search <String>] [-Select <String[]>]
[-Skip <UInt64>] [<CommonParameters>]
Get-AzADUser [-Count] [-AppendSelected] [-ConsistencyLevel <String>] [-DefaultProfile <PSObject>]
[-Expand <String[]>] [-Filter <String>] [-First <UInt64>] [-Orderby <String[]>] [-Search <String>]
[-Select <String[]>] [-Skip <UInt64>] [<CommonParameters>]
```

### DisplayNameParameterSet
Expand Down Expand Up @@ -114,6 +114,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Count
Include count of items

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: List
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.

Expand Down
48 changes: 37 additions & 11 deletions src/Resources/MSGraph.Autorest/docs/New-AzADUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Adds new entity to users

## SYNTAX

### WithPassword (Default)
```
New-AzADUser -DisplayName <String> -MailNickname <String> -Password <SecureString> -UserPrincipalName <String>
[-AboutMe <String>] [-AccountEnabled <Boolean>] [-AgeGroup <String>] [-Birthday <DateTime>] [-City <String>]
Expand All @@ -21,25 +22,50 @@ New-AzADUser -DisplayName <String> -MailNickname <String> -Password <SecureStrin
[-FaxNumber <String>] [-ForceChangePasswordNextLogin] [-GivenName <String>] [-HireDate <DateTime>]
[-ImmutableId <String>] [-Interest <String[]>] [-IsResourceAccount] [-JobTitle <String>] [-Mail <String>]
[-MobilePhone <String>] [-MySite <String>] [-OfficeLocation <String>] [-OtherMail <String[]>]
[-PasswordPolicy <String>] [-PasswordProfile <IMicrosoftGraphPasswordProfile>] [-PostalCode <String>]
[-PreferredLanguage <String>] [-PreferredName <String>] [-Responsibility <String[]>] [-School <String[]>]
[-ShowInAddressList] [-Skill <String[]>] [-State <String>] [-StreetAddress <String>] [-Surname <String>]
[-UsageLocation <String>] [-UserType <String>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf]
[<CommonParameters>]
[-PasswordPolicy <String>] [-PostalCode <String>] [-PreferredLanguage <String>] [-PreferredName <String>]
[-Responsibility <String[]>] [-School <String[]>] [-ShowInAddressList] [-Skill <String[]>] [-State <String>]
[-StreetAddress <String>] [-Surname <String>] [-UsageLocation <String>] [-UserType <String>]
[-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```

### WithPasswordProfile
```
New-AzADUser -DisplayName <String> -MailNickname <String> -PasswordProfile <IMicrosoftGraphPasswordProfile>
-UserPrincipalName <String> [-AboutMe <String>] [-AccountEnabled <Boolean>] [-AgeGroup <String>]
[-Birthday <DateTime>] [-City <String>] [-CompanyName <String>] [-ConsentProvidedForMinor <String>]
[-Country <String>] [-DeletedDateTime <DateTime>] [-Department <String>] [-DeviceEnrollmentLimit <Int32>]
[-EmployeeHireDate <DateTime>] [-EmployeeId <String>] [-EmployeeType <String>] [-ExternalUserState <String>]
[-ExternalUserStateChangeDateTime <DateTime>] [-FaxNumber <String>] [-GivenName <String>]
[-HireDate <DateTime>] [-ImmutableId <String>] [-Interest <String[]>] [-IsResourceAccount]
[-JobTitle <String>] [-Mail <String>] [-MobilePhone <String>] [-MySite <String>] [-OfficeLocation <String>]
[-OtherMail <String[]>] [-PasswordPolicy <String>] [-PostalCode <String>] [-PreferredLanguage <String>]
[-PreferredName <String>] [-Responsibility <String[]>] [-School <String[]>] [-ShowInAddressList]
[-Skill <String[]>] [-State <String>] [-StreetAddress <String>] [-Surname <String>] [-UsageLocation <String>]
[-UserType <String>] [-DefaultProfile <PSObject>] [-Confirm] [-WhatIf] [<CommonParameters>]
```

## DESCRIPTION
Adds new entity to users

## EXAMPLES

### Example 1: Create user
### Example 1: Create user with password profile
```powershell
$password = "xxxxxxxxxx"
$pp = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile" -Property @{Password=$password}
New-AzADUser -DisplayName $uname -PasswordProfile $pp -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
```

Create user
Create user with password profile

### Example 2: Create user with password
```powershell
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
```

Create user with password

## PARAMETERS

Expand Down Expand Up @@ -363,7 +389,7 @@ Default behavior is (false) to not change the password on the next successful lo

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Parameter Sets: WithPassword
Aliases:

Required: False
Expand Down Expand Up @@ -585,7 +611,7 @@ It is recommended to set a strong password.

```yaml
Type: System.Security.SecureString
Parameter Sets: (All)
Parameter Sets: WithPassword
Aliases:

Required: True
Expand Down Expand Up @@ -619,10 +645,10 @@ To construct, see NOTES section for PASSWORDPROFILE properties and create a hash

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile
Parameter Sets: (All)
Parameter Sets: WithPasswordProfile
Aliases:

Required: False
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/MSGraph.Autorest/docs/Remove-AzADUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ To create the parameters described below, construct a hash table containing the
- `[DeviceVersion <Int32?>]`: For internal use only.
- `[EmployeeHireDate <DateTime?>]`: The date and time when the user was hired or will start work in case of a future hire. Supports $filter (eq, ne, NOT , ge, le, in).
- `[EmployeeId <String>]`: The employee identifier assigned to the user by the organization. Supports $filter (eq, ne, NOT , ge, le, in, startsWith).
- `[EmployeeOrgData <IMicrosoftGraphEmployeeOrgData>]`: employeeOrgData
- `[(Any) <Object>]`: This indicates any property can be added to this object.
- `[CostCenter <String>]`: The cost center associated with the user. Returned only on $select. Supports $filter.
- `[Division <String>]`: The name of the division in which the user works. Returned only on $select. Supports $filter.
- `[EmployeeType <String>]`: Captures enterprise worker type. For example, Employee, Contractor, Consultant, or Vendor. Supports $filter (eq, ne, NOT , ge, le, in, startsWith).
- `[ExternalUserState <String>]`: For an external user invited to the tenant using the invitation API, this property represents the invited user's invitation status. For invited users, the state can be PendingAcceptance or Accepted, or null for all other users. Supports $filter (eq, ne, NOT , in).
- `[ExternalUserStateChangeDateTime <DateTime?>]`: Shows the timestamp for the latest change to the externalUserState property. Supports $filter (eq, ne, NOT , in).
Expand All @@ -249,6 +253,9 @@ To create the parameters described below, construct a hash table containing the
- `[JobTitle <String>]`: The user's job title. Maximum length is 128 characters. Supports $filter (eq, ne, NOT , ge, le, in, startsWith).
- `[Mail <String>]`: The SMTP address for the user, for example, [email protected]. Changes to this property will also update the user's proxyAddresses collection to include the value as an SMTP address. While this property can contain accent characters, using them can cause access issues with other Microsoft applications for the user. Supports $filter (eq, ne, NOT, ge, le, in, startsWith, endsWith).
- `[MailNickname <String>]`: The mail alias for the user. This property must be specified when a user is created. Maximum length is 64 characters. Supports $filter (eq, ne, NOT, ge, le, in, startsWith).
- `[Manager <IMicrosoftGraphDirectoryObject>]`: Represents an Azure Active Directory object. The directoryObject type is the base type for many other directory entity types.
- `[DeletedDateTime <DateTime?>]`:
- `[DisplayName <String>]`: The name displayed in directory
- `[OfficeLocation <String>]`: The office location in the user's place of business. Maximum length is 128 characters. Supports $filter (eq, ne, NOT, ge, le, in, startsWith).
- `[OnPremisesImmutableId <String>]`: This property is used to associate an on-premises Active Directory user account to their Azure AD user object. This property must be specified when creating a new user account in the Graph if you are using a federated domain for the user's userPrincipalName (UPN) property. NOTE: The $ and _ characters cannot be used when specifying this property. Returned only on $select. Supports $filter (eq, ne, NOT, ge, le, in)..
- `[OnPremisesLastSyncDateTime <DateTime?>]`: The last time at which the object was synced with the on-premises directory. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z Read-only. Supports $filter (eq, ne, not, ge, le, in).
Expand Down
7 changes: 7 additions & 0 deletions src/Resources/MSGraph.Autorest/docs/Update-AzADUser.md
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,10 @@ To create the parameters described below, construct a hash table containing the
- `[DeviceVersion <Int32?>]`: For internal use only.
- `[EmployeeHireDate <DateTime?>]`: The date and time when the user was hired or will start work in case of a future hire. Supports $filter (eq, ne, NOT , ge, le, in).
- `[EmployeeId <String>]`: The employee identifier assigned to the user by the organization. Supports $filter (eq, ne, NOT , ge, le, in, startsWith).
- `[EmployeeOrgData <IMicrosoftGraphEmployeeOrgData>]`: employeeOrgData
- `[(Any) <Object>]`: This indicates any property can be added to this object.
- `[CostCenter <String>]`: The cost center associated with the user. Returned only on $select. Supports $filter.
- `[Division <String>]`: The name of the division in which the user works. Returned only on $select. Supports $filter.
- `[EmployeeType <String>]`: Captures enterprise worker type. For example, Employee, Contractor, Consultant, or Vendor. Supports $filter (eq, ne, NOT , ge, le, in, startsWith).
- `[ExternalUserState <String>]`: For an external user invited to the tenant using the invitation API, this property represents the invited user's invitation status. For invited users, the state can be PendingAcceptance or Accepted, or null for all other users. Supports $filter (eq, ne, NOT , in).
- `[ExternalUserStateChangeDateTime <DateTime?>]`: Shows the timestamp for the latest change to the externalUserState property. Supports $filter (eq, ne, NOT , in).
Expand All @@ -898,6 +902,9 @@ To create the parameters described below, construct a hash table containing the
- `[JobTitle <String>]`: The user's job title. Maximum length is 128 characters. Supports $filter (eq, ne, NOT , ge, le, in, startsWith).
- `[Mail <String>]`: The SMTP address for the user, for example, [email protected]. Changes to this property will also update the user's proxyAddresses collection to include the value as an SMTP address. While this property can contain accent characters, using them can cause access issues with other Microsoft applications for the user. Supports $filter (eq, ne, NOT, ge, le, in, startsWith, endsWith).
- `[MailNickname <String>]`: The mail alias for the user. This property must be specified when a user is created. Maximum length is 64 characters. Supports $filter (eq, ne, NOT, ge, le, in, startsWith).
- `[Manager <IMicrosoftGraphDirectoryObject>]`: Represents an Azure Active Directory object. The directoryObject type is the base type for many other directory entity types.
- `[DeletedDateTime <DateTime?>]`:
- `[DisplayName <String>]`: The name displayed in directory
- `[OfficeLocation <String>]`: The office location in the user's place of business. Maximum length is 128 characters. Supports $filter (eq, ne, NOT, ge, le, in, startsWith).
- `[OnPremisesImmutableId <String>]`: This property is used to associate an on-premises Active Directory user account to their Azure AD user object. This property must be specified when creating a new user account in the Graph if you are using a federated domain for the user's userPrincipalName (UPN) property. NOTE: The $ and _ characters cannot be used when specifying this property. Returned only on $select. Supports $filter (eq, ne, NOT, ge, le, in)..
- `[OnPremisesLastSyncDateTime <DateTime?>]`: The last time at which the object was synced with the on-premises directory. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z Read-only. Supports $filter (eq, ne, not, ge, le, in).
Expand Down
14 changes: 12 additions & 2 deletions src/Resources/MSGraph.Autorest/examples/New-AzADUser.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
### Example 1: Create user
### Example 1: Create user with password profile
```powershell
$password = "xxxxxxxxxx"
$pp = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile" -Property @{Password=$password}
New-AzADUser -DisplayName $uname -PasswordProfile $pp -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
```

Create user
Create user with password profile

### Example 2: Create user with password
```powershell
$password = "xxxxxxxxxx"
$password = ConvertTo-SecureString -AsPlainText -Force $password
New-AzADUser -DisplayName $uname -Password $password -AccountEnabled $true -MailNickname $nickname -UserPrincipalName $upn
```

Create user with password
6 changes: 6 additions & 0 deletions src/Resources/MSGraph.Autorest/exports/Get-AzADUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ function Get-AzADUser {
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphUser])]
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
param(
[Parameter(ParameterSetName='List')]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Query')]
[System.Management.Automation.SwitchParameter]
# Include count of items
${Count},

[Parameter()]
[AllowEmptyCollection()]
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
Expand Down
Loading