Set-PartnerCustomerUserLicense
Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.
Syntax
Set-PartnerCustomerUserLicense
-CustomerId <String>
-LicenseUpdate <PSLicenseUpdate>
-UserId <String>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.
Examples
Example 1
PS C:\> # Create the objects that will be needed
PS C:\> $license = New-Object -TypeName Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSLicenseAssignment
PS C:\> $licenses = New-Object -TypeName Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSLicenseUpdate
PS C:\>
PS C:\> # Find the SkuId of the license we want to add - in this example we will use the O365_BUSINESS_PREMIUM license
PS C:\> $license.SkuId = (Get-PartnerCustomerLicense -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' | Where-Object -Property SkuPartNumber -Value "O365_BUSINESS_PREMIUM" -EQ).SkuId
PS C:\>
PS C:\> # Add the license to the update statement.
PS C:\> $licenses.LicensesToAssign.Add($license)
PS C:\>
PS C:\> # Call the command to update the license assignment.
PS C:\> Set-PartnerCustomerUserLicense -CustomerId '46a62ece-10ad-42e5-b3f1-b2ed53e6fc08' -LicenseUpdate $licenses -UserId '00aa00aa-bb11-cc22-dd33-44ee44ee44ee'
Adds or removes licenses for a Microsoft online service to the list of assigned licenses for a user.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CustomerId
The identifier for the customer.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LicenseUpdate
The information used to update the license assignments.
Type: | PSLicenseUpdate |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-UserId
The identifier for the user.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
Microsoft.Store.PartnerCenter.PowerShell.Models.Licenses.PSLicenseUpdate