Checking Power Apps Licensing using PowerShell

Loading

Managing Power Apps licenses is crucial for ensuring compliance, optimizing costs, and assigning the correct licenses to users. With PowerShell, administrators can efficiently check user licenses and ensure they have the required access to Power Platform features.


Step 1: Install the Required PowerShell Modules

Before proceeding, install the necessary PowerShell modules for Power Apps and Microsoft 365:

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -AllowClobber
Install-Module -Name Microsoft.PowerApps.PowerShell -Force -AllowClobber
Install-Module -Name AzureAD -Force
Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force

If prompted, press Y to confirm installation.


Step 2: Authenticate to Power Platform

Log in using an Admin account:

Add-PowerAppsAccount

For Microsoft 365 & Azure AD Authentication, run:

Connect-AzureAD
Connect-MgGraph -Scopes "User.Read.All", "Directory.Read.All"

These commands allow access to user licensing information.


Step 3: Retrieve Power Apps Licensed Users

To check which users have Power Apps licenses:

Get-AzureADUser | ForEach-Object {
$user = $_
$licenses = Get-AzureADUserLicenseDetail -ObjectId $user.ObjectId
$licenses | ForEach-Object {
if ($_.SkuPartNumber -like "*POWERAPPS*") {
[PSCustomObject]@{
DisplayName = $user.DisplayName
UserPrincipalName = $user.UserPrincipalName
LicenseName = $_.SkuPartNumber
}
}
}
} | Format-Table -AutoSize

This will display a table of users with Power Apps licenses.


Step 4: Export Power Apps Licensing Data to CSV

To save the licensing details in a CSV file:

$outputPath = "C:\PowerPlatform\PowerAppsLicenses.csv"

Get-AzureADUser | ForEach-Object {
$user = $_
$licenses = Get-AzureADUserLicenseDetail -ObjectId $user.ObjectId
$licenses | ForEach-Object {
if ($_.SkuPartNumber -like "*POWERAPPS*") {
[PSCustomObject]@{
DisplayName = $user.DisplayName
UserPrincipalName = $user.UserPrincipalName
LicenseName = $_.SkuPartNumber
}
}
}
} | Export-Csv -Path $outputPath -NoTypeInformation

The report will be saved as PowerAppsLicenses.csv at C:\PowerPlatform.


Step 5: Check Available Power Apps Licenses in the Tenant

To see all Power Apps license types available in your organization:

Get-AzureADSubscribedSku | Select SkuPartNumber, SkuId

This will list all Power Apps-related licenses, such as:

  • POWERAPPS_PER_USER
  • POWERAPPS_PER_APP
  • POWERAPPS_PER_USER_TRIAL
  • DYN365_CDS_VIRAL

Step 6: Check a Specific User’s Power Apps License

To check if a specific user has a Power Apps license:

$userEmail = "user@domain.com"
$user = Get-AzureADUser -Filter "UserPrincipalName eq '$userEmail'"
$licenses = Get-AzureADUserLicenseDetail -ObjectId $user.ObjectId

$licenses | Select-Object SkuPartNumber

This will return Power Apps licenses assigned to the user.


Step 7: Remove a Power Apps License from a User (Optional)

If a user no longer needs a Power Apps license, you can remove it:

$userEmail = "user@domain.com"
$user = Get-AzureADUser -Filter "UserPrincipalName eq '$userEmail'"
$licenseToRemove = "POWERAPPS_PER_USER"

Set-AzureADUserLicense -ObjectId $user.ObjectId -RemoveLicenses @($licenseToRemove)

Use with caution to avoid accidental license revocation.


Step 8: Disconnect from Power Platform

Once done, disconnect the session:

Disconnect-AzureAD
Disconnect-MgGraph
Disconnect-PowerAppsAccount

Leave a Reply

Your email address will not be published. Required fields are marked *