95 строки
3.3 KiB
YAML
95 строки
3.3 KiB
YAML
|
### YamlMime:PowershellCmdlet
|
||
|
summary: |-
|
||
|
Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.
|
||
|
module: AzureAD
|
||
|
notes: ""
|
||
|
syntaxes:
|
||
|
- >-
|
||
|
Set-AzureADUserLicense -ObjectId <String> -AssignedLicenses <AssignedLicenses>
|
||
|
|
||
|
[-InformationAction <ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]
|
||
|
examples:
|
||
|
- title: 'Example 1: Add a license to a user based on a template user'
|
||
|
code: |-
|
||
|
PS C:\> $LicensedUser = Get-AzureADUser -ObjectId "TemplateUser@contoso.com"
|
||
|
PS C:\> $User = Get-AzureADUser -ObjectId "User@contoso.com"
|
||
|
PS C:\> $License = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
|
||
|
PS C:\> $License.SkuId = $LicensedUser.AssignedLicenses.SkuId
|
||
|
PS C:\> $Licenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
|
||
|
PS C:\> $Licenses.AddLicenses = $License
|
||
|
PS C:\> Set-AzureADUserLicense -ObjectId $User.ObjectId -AssignedLicenses $Licenses
|
||
|
description: |-
|
||
|
The first command gets a user by using the Get-AzureADUser (./Get-AzureADUser.md)cmdlet, and then stores it in the $LicensedUser variable.
|
||
|
|
||
|
The second command gets another user by using Get-AzureADUser , and then stores it in the $User variable.
|
||
|
|
||
|
The third command creates an AssignedLicense type, and then stores it in the $License variable.
|
||
|
|
||
|
The fourth command set the SkuId property of $License to the same value as the SkuId property of $LicensedUser.
|
||
|
|
||
|
The fifth commmand creates an AssignedLicenses object, and stores it in the $Licenses variable.
|
||
|
|
||
|
The sixth command adds the license in $License to $Licenses.
|
||
|
|
||
|
The final command assigns the licenses in $Licenses to the user in $User.
|
||
|
The licenses in $Licenses includes $License from the third and fourth commands.
|
||
|
summary: ""
|
||
|
parameters:
|
||
|
- type: <xref href="AssignedLicenses" data-throw-if-not-resolved="False" />
|
||
|
name: AssignedLicenses
|
||
|
isRequired: true
|
||
|
description: |+
|
||
|
Specifies a list of licenses to assign or remove.
|
||
|
|
||
|
defaultValue: None
|
||
|
pipelineInput: true
|
||
|
position: Named
|
||
|
aliases: ""
|
||
|
parameterValueGroup: ""
|
||
|
- type: <xref href="ActionPreference" data-throw-if-not-resolved="False" />
|
||
|
name: InformationAction
|
||
|
description: |+
|
||
|
Specifies how this cmdlet responds to an information event.
|
||
|
The acceptable values for this parameter are:
|
||
|
|
||
|
- Continue
|
||
|
- Ignore
|
||
|
- Inquire
|
||
|
- SilentlyContinue
|
||
|
- Stop
|
||
|
- Suspend
|
||
|
|
||
|
defaultValue: None
|
||
|
position: Named
|
||
|
aliases: infa
|
||
|
parameterValueGroup: ""
|
||
|
- type: <xref href="String" data-throw-if-not-resolved="False" />
|
||
|
name: InformationVariable
|
||
|
description: |+
|
||
|
Specifies an information variable.
|
||
|
|
||
|
defaultValue: None
|
||
|
position: Named
|
||
|
aliases: iv
|
||
|
parameterValueGroup: ""
|
||
|
- type: <xref href="String" data-throw-if-not-resolved="False" />
|
||
|
name: ObjectId
|
||
|
isRequired: true
|
||
|
description: |+
|
||
|
Specifies the ID of a user (as a UPN or ObjectId) in Azure AD.
|
||
|
|
||
|
defaultValue: None
|
||
|
pipelineInput: true
|
||
|
position: Named
|
||
|
aliases: ""
|
||
|
parameterValueGroup: ""
|
||
|
uid: AzureAD.Set-AzureADUserLicense
|
||
|
name: Set-AzureADUserLicense
|
||
|
description: |-
|
||
|
The Set-AzureADUserLicense adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.
|
||
|
metadata:
|
||
|
external help file: Microsoft.Open.AzureAD16.Graph.PowerShell.dll-Help.xml
|
||
|
Module Name: AzureAD
|
||
|
online version: ""
|
||
|
schema: 2.0.0
|