Comments on: Microsoft Forces Move from Azure AD Cmdlets for License Management https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/ Practical Office 365 News, Tips, and Tutorials Tue, 15 Mar 2022 21:21:01 +0000 hourly 1 https://wordpress.org/?v=6.3.2 By: Tony Redmond https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237658 Wed, 02 Feb 2022 10:32:28 +0000 https://practical365.com/?p=53319#comment-237658 In reply to Sarka.

AddLicenses is a hash table.

But I would add the licenses separately so that you can detect errors, like not having a license available for a particular SKU.

]]>
By: Sarka https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237657 Wed, 02 Feb 2022 10:24:10 +0000 https://practical365.com/?p=53319#comment-237657 Hi,
can I with one cmdlet Set-MgUserLicense add more SkuIds at the same time? How to construct AddLicenses parameter.
Thanks.

]]>
By: Abhi https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237544 Sat, 15 Jan 2022 07:13:52 +0000 https://practical365.com/?p=53319#comment-237544 How can we use it using Azure Runbook. I tried with delegated access and also with application access. but it is not working?

Any help is much appreciated.

Thanks

]]>
By: Tony Redmond https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237438 Tue, 04 Jan 2022 03:17:12 +0000 https://practical365.com/?p=53319#comment-237438 In reply to Adam Leinss.

The joys of dealing with the Graph…

]]>
By: Adam Leinss https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237434 Mon, 03 Jan 2022 20:11:15 +0000 https://practical365.com/?p=53319#comment-237434 In reply to Adam Leinss.

I think I figured it out, had to use delegated access not app-only authenication.

]]>
By: Adam Leinss https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237432 Mon, 03 Jan 2022 19:51:02 +0000 https://practical365.com/?p=53319#comment-237432 I’m trying to get this to work. However, it seems I cannot set the scopes.

Connect-MgGraph -Scopes “User.ReadWrite.All”,”Directory.ReadWrite.All” -ClientID X -TenantId X -CertificateThumbprint X

I get Connect-MgGraph : Parameter set cannot be resolved using the specified named parameters. If I try with just -Scopes, it wants me to login (this needs to be automated via the task scheduler).

If I try just Get-MgSubscribedSku:

Get-MgSubscribedSku : Insufficient privileges to complete the operation.

I granted the app these rights in Azure:

Directory.Read.All,
Group.Read.All,
Group.ReadWrite.All,
User.Read.All,
User.ReadWrite.All

Very tempted to just grant it every right in the world. Why does it have to be so hard Microsoft?

]]>
By: Alex https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-237167 Tue, 23 Nov 2021 14:22:46 +0000 https://practical365.com/?p=53319#comment-237167 Thank you, this is very helpful, yay to changes from Microsoft 😀

]]>
By: Tony Redmond https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-236937 Tue, 26 Oct 2021 16:00:15 +0000 https://practical365.com/?p=53319#comment-236937 In reply to Gagan.

The code works. What you see in the article is an extract. You should use the complete script from GitHub to test.

What hash table are you referring to?

]]>
By: Gagan https://practical365.com/microsoft-forces-move-from-azure-ad-cmdlets-for-license-management/#comment-236936 Tue, 26 Oct 2021 15:52:00 +0000 https://practical365.com/?p=53319#comment-236936 $ExistingDisabledPlans = $Null
ForEach ($S in $User.AssignedLicenses) { # Check for existing disabled licenses
If ($S.SkuId -eq $SelectedSkuId) {
$ExistingDisabledPlans = $S.DisabledPlans }
}
$ExistingDisabledPlans += $ServicePlanId # Add the plan we want to remove to the set of disabled plans
$LicenseToRemove = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphAssignedLicense
$LicenseToRemove.SkuId = $SelectedSkuId
$LicenseToRemove.DisabledPlans = $ExistingDisabledPlans
$Status = Set-MgUserLicense -UserId $User.id -AddLicenses $LicenseToRemove -RemoveLicenses @()
}
Is not working as there is a “}” missing in the code.

Also as per the Microsoft article they have mentioned about the hash table to be used to assign required license.

]]>