M365Permissions Module

Let’s be honest, the TeamPermissions module ‘s name has quickly lost touch with what it does (already doing Sharepoint and Onedrive as well).

Adding the overwhelming number of positive reactions and rapid adoption, I want to add even more features:

  1. Scanning EntraID roles
  2. Scanning Exchange roles
  3. Scanning Mailbox permissions
  4. Change detection (between scans)
  5. Scanning Azure RM roles
  6. Scanning PowerBI roles
  7. SPN based scanning

So I’ve decided to rename it to M365Permissions!

Obviously it’ll take a lot of time/work to get above coded up and tested.

But for now I can already give you the M365Permissions PowerShell module, which includes:

  • EntraID roles (permanent and eligible)
  • Lots of bug fixes
  • Performance improvements (especially with lots of small sites)
  • Everything the TeamPermissions module did

Please give it a spin and let me know what other features you’d like to see!

Other links:

M365Permissions in the PSGallery

M365Permissions on Github

Locally detecting a user’s sign in to Microsoft Teams

A customer wanted to see when/if users were doing their first sign in to MS Teams (on new devices), and if this was against their tenant. Mostly untested but for the world since I couldn’t google it:

function checkTeams(){
    $teamsLogPath = Join-Path $($env:LOCALAPPDATA) "packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\ecs_request_param.json"
    if((Test-Path $teamsLogPath)){
        $state = Get-Content $teamsLogPath | ConvertFrom-JSON
        if($state -and $state.tenantId -eq "YOUR TENANT GUID"){
            return $true
        }else{
            return $false
        }
    }else{
        return $false
    }    
}

Get-CsTeamsMeetingPolicy: Invalid credential Provide valid credential.

For those googling, above error happened for us when trying to use application-based authentication for the MS Teams PowerShell commandlets.

We followed the instructions but kept getting Invalid credential Provide valid credential whenever calling a cmdlet, while the connect-microsoftteams command worked fine with the -accesstokens param.

Turns out, when you assign application level permissions to your service principal on top of the delegated permissions, the SPN is not authorized for all subsequent cmdlet calls :O

Microsoft 365, Azure, Automation & Code