forsteri95 / script

0 stars 0 forks source link

test #2

Open forsteri95 opened 1 year ago

forsteri95 commented 1 year ago

Connect to Azure AD

Connect-AzureAD

Set variables for the group and license to be assigned

$groupName = "Group Name" $licenseName = "License Name"

Get the group object

$group = Get-AzureADGroup -SearchString $groupName

Get the license object

$license = Get-AzureADSubscribedSku | Where-Object {$_.SkuPartNumber -eq $licenseName}

Assign the license to the group

$licenseAssignment = New-AzureADGroupLicenseAssignment -ObjectId $group.ObjectId -SkuId $license.SkuId

forsteri95 commented 1 year ago

You will need to replace the values for $groupName and $licenseName with the appropriate values for your environment.

Also, make sure you have the Azure AD PowerShell module installed and connect to Azure AD before running the script.