Skip to main content

Posts

Showing posts from February, 2022

Power Platform Audit Scripts using PowerShell -Licenses

Get Power Platform Licenses using PowerShell C lear-Host Install-Module -Name Microsoft.PowerApps.Administration.PowerShell Add-PowerAppsAccount $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition $OutputFilePath = "$scriptPath\Licenses.csv" $TimeoutInMinutes = 2 $ApiVersion = "2016-11-01" $getLicensesUri = "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/scopes/admin/exportServicePlans?api-version={apiVersion}"   $getLicensesResponse = InvokeApi -Method POST -Route $getLicensesUri -ApiVersion $ApiVersion -Verbose $false if ($getLicensesResponse.StatusCode -eq 202) {     $getLicensesUri = $getLicensesResponse.Headers['Location']     $currentTime = Get-Date -format HH:mm:ss     $nextTime = Get-Date -format HH:mm:ss     $TimeDiff = New-TimeSpan $currentTime $nextTime              #Wait until the operation complete, there is an error, or we hit a timeout     while...