WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
885f1ac
Revise Teams app management instructions
skirkpatrickMSFT Nov 17, 2025
6d02c07
Revise app management note in teams.md
skirkpatrickMSFT Nov 17, 2025
84c97da
Refactor app permission policy compliance checks
skirkpatrickMSFT Nov 17, 2025
0d936ab
Enhance authentication handling in ExportTeamsProvider
skirkpatrickMSFT Nov 17, 2025
be54c21
Refactor BuildDetails functions to ignore LegacyDetails
skirkpatrickMSFT Nov 17, 2025
3868a85
Add mock method for Get-M365UnifiedTenantSettings
skirkpatrickMSFT Nov 17, 2025
004c855
Enhance legacy app permission policy report details
skirkpatrickMSFT Nov 18, 2025
33965a1
Add tests for Teams app policies validation
skirkpatrickMSFT Nov 18, 2025
8db0ba0
Remove obsolete tests for Teams policies
skirkpatrickMSFT Nov 18, 2025
ac40780
Update app details functions to include compliance check
skirkpatrickMSFT Nov 18, 2025
ec2714c
Refactor BuildDetails functions to include compliance
skirkpatrickMSFT Nov 18, 2025
27b97c3
Add UseNewTeamsAppSettings parameter for Teams auth
skirkpatrickMSFT Nov 18, 2025
966f3e0
Enhance ExportTeamsProvider with new settings option
skirkpatrickMSFT Nov 18, 2025
e1703e6
Add tests for JSON export with new options
skirkpatrickMSFT Nov 18, 2025
af9886e
Fix assertion syntax in TeamsProvider tests
skirkpatrickMSFT Nov 18, 2025
acd1aef
Refactor report detail strings for clarity
skirkpatrickMSFT Nov 20, 2025
bee049b
Refactor tenant details messages for clarity
skirkpatrickMSFT Nov 20, 2025
065f5e7
Update report details for app permission policies
skirkpatrickMSFT Nov 20, 2025
8ac8cdf
Clarify legacy command usage in application policies
skirkpatrickMSFT Nov 20, 2025
3500f26
Highlight legacy command warning in teams.md
skirkpatrickMSFT Nov 21, 2025
189e02a
Merge branch 'main' into 1664-update-scubagear-implementation-for-tea…
skirkpatrickMSFT Nov 21, 2025
1ca41df
Update app management note in teams.md
skirkpatrickMSFT Dec 2, 2025
5380a14
Update app management notes in teams.md
skirkpatrickMSFT Dec 2, 2025
9710952
Update guidance on legacy command usage in Teams
skirkpatrickMSFT Dec 2, 2025
f70cbd9
Clarify app management policies in Teams documentation
skirkpatrickMSFT Dec 2, 2025
1ff5cdf
Simplify Teams app permission policy command
skirkpatrickMSFT Dec 2, 2025
26e7347
Revise legacy app management instructions in teams.md
skirkpatrickMSFT Dec 3, 2025
aa34917
Update legacy command usage instructions in teams.md
skirkpatrickMSFT Dec 3, 2025
40f6b84
Remove ValidateNotNullOrEmpty from parameter
skirkpatrickMSFT Dec 3, 2025
6523061
Merge branch 'main' into 1664-update-scubagear-implementation-for-tea…
skirkpatrickMSFT Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions PowerShell/ScubaGear/Modules/Orchestrator.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ function Invoke-SCuBA {
.Parameter SkipDoH
If true, do not fallback to DoH should the traditional DNS requests fail
when retrieving any DNS records required by specific SCuBA policies.
.Parameter UseNewTeamsAppSettings
When using interactive authentication for Teams, this switch enables ScubaGear to validate
the newer org-wide app settings (MS.TEAMS.5.1v2, 5.2v2, 5.3v2) instead of the legacy
app permission policies (MS.TEAMS.5.1v1, 5.2v1, 5.3v1). By default, interactive authentication
validates the legacy v1 settings. Certificate-based authentication always validates legacy settings
regardless of this parameter.
.Example
Invoke-SCuBA
Run an assessment against by default a commercial M365 Tenant against the
Expand Down Expand Up @@ -291,7 +297,12 @@ function Invoke-SCuBA {
[ValidateNotNullOrEmpty()]
[ValidateSet($true, $false)]
[boolean]
$SkipDoH = [ScubaConfig]::ScubaDefault('DefaultSkipDoH')
$SkipDoH = [ScubaConfig]::ScubaDefault('DefaultSkipDoH'),

[Parameter(Mandatory = $false, ParameterSetName = 'Configuration')]
[Parameter(Mandatory = $false, ParameterSetName = 'Report')]
[switch]
$UseNewTeamsAppSettings
)
process {
# Retrieve ScubaGear Module versions
Expand Down Expand Up @@ -619,7 +630,14 @@ function Invoke-ProviderList {
$RetVal = Export-SharePointProvider @SPOProviderParams | Select-Object -Last 1
}
"teams" {
$RetVal = Export-TeamsProvider | Select-Object -Last 1
$TeamsProviderParams = @{}
if ($BoundParameters.AppID) {
$TeamsProviderParams += @{CertificateBasedAuth = $true}
}
if ($BoundParameters.UseNewTeamsAppSettings) {
$TeamsProviderParams += @{UseNewSettings = $true}
}
$RetVal = Export-TeamsProvider @TeamsProviderParams | Select-Object -Last 1
}
default {
Write-Error -Message "Invalid ProductName argument"
Expand All @@ -646,8 +664,8 @@ function Invoke-ProviderList {
$TimeZone = ($GetTimeZone).StandardName
}

$ConfigDetails = @(ConvertTo-Json -Depth 100 $ScubaConfig)
if(! $ConfigDetails) {
$ConfigDetails = ConvertTo-Json -Depth 100 $([ScubaConfig]::GetInstance().Configuration)
if((! $ConfigDetails) -or ($ConfigDetails -eq "null")) {
$ConfigDetails = "{}"
}

Expand Down
52 changes: 52 additions & 0 deletions PowerShell/ScubaGear/Modules/Providers/ExportTeamsProvider.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ function Export-TeamsProvider {
Internal
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[switch]
$CertificateBasedAuth = $false,

[Parameter(Mandatory = $false)]
[switch]
$UseNewSettings = $false
)

$HelperFolderPath = Join-Path -Path $PSScriptRoot -ChildPath "ProviderHelpers"
Import-Module (Join-Path -Path $HelperFolderPath -ChildPath "CommandTracker.psm1")
Expand All @@ -18,6 +27,48 @@ function Export-TeamsProvider {
$ClientConfig = ConvertTo-Json @($Tracker.TryCommand("Get-CsTeamsClientConfiguration"))
$AppPolicies = ConvertTo-Json @($Tracker.TryCommand("Get-CsTeamsAppPermissionPolicy"))
$BroadcastPolicies = ConvertTo-Json @($Tracker.TryCommand("Get-CsTeamsMeetingBroadcastPolicy"))

# Determine which Teams app settings to retrieve based on authentication method and user preference
# Three scenarios:
# 1. Certificate-based auth: Always use legacy settings (Get-M365UnifiedTenantSettings unavailable)
# 2. Interactive auth with -UseNewTeamsAppSettings: Use new org-wide settings by user choice
# 3. Interactive auth without switch: Use legacy settings (default)

if ($CertificateBasedAuth) {
# Scenario 1: Certificate-based authentication - legacy only
Write-Warning @"
Certificate-based authentication detected.
- Legacy Teams app permission policies will be validated for MS.TEAMS.5.1v1, 5.2v1, and 5.3v1 policies.
- Org-wide app settings cannot be retrieved with certificate authentication (Get-M365UnifiedTenantSettings requires user login).
- If your organization uses the newer Teams Admin Center org-wide app settings,
please re-run ScubaGear using interactive user authentication with the -UseNewTeamsAppSettings parameter
to validate policies MS.TEAMS.5.1v2, 5.2v2, and 5.3v2 against new settings.
"@
$TenantAppSettings = ConvertTo-Json @()
}
elseif ($UseNewSettings) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having a hard time with the parameter. Even when I use it with interactive auth, I'm still getting the legacy check. I'm I doing something wrong?

Image

Copy link
Collaborator Author

@skirkpatrickMSFT skirkpatrickMSFT Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HMMM. Not sure what is going on there. I used the same comand as you and I get the new settings.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adhilto I removed ValidateNotNullOrEmpty from the parameter. Not sure that would resolve it but curious if it was affecting the use of the parameter. Everything still functions correctly on my side.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't help unfortunately. I even tested on a different tenant (the one that does show me the new settings in the admin center), same thing. Next step would probably be to see if anyone else can replicate this, or if it's somehow a just me thing.

# Scenario 2: Interactive auth with explicit new settings preference
Write-Warning @"
Interactive authentication with -UseNewTeamsAppSettings parameter detected.
- Org-wide app settings (newer v2 policies) will be validated for MS.TEAMS.5.1v2, 5.2v2, and 5.3v2.
- Legacy Teams app permission policies (MS.TEAMS.5.1v1, 5.2v1, 5.3v1) will NOT be validated.
- To validate legacy Teams app permission policies instead,
re-run ScubaGear without the -UseNewTeamsAppSettings parameter.
"@
# Interactive/user authentication - attempt to get org-wide app settings
$TenantAppSettings = ConvertTo-Json @($Tracker.TryCommand("Get-M365UnifiedTenantSettings"))
}
else {
# Scenario 3: Interactive auth, default behavior - use legacy settings
Write-Warning @"
Interactive/user authentication detected (default mode).
- Legacy Teams app permission policies will be validated for MS.TEAMS.5.1v1, 5.2v1, and 5.3v1 policies.
- Org-wide app settings (newer v2 policies) will NOT be retrieved.
- If your organization uses the newer Teams Admin Center org-wide app settings,
re-run ScubaGear with the -UseNewTeamsAppSettings parameter to validate MS.TEAMS.5.1v2, 5.2v2, and 5.3v2 instead.
"@
$TenantAppSettings = ConvertTo-Json @()
}

$TeamsSuccessfulCommands = ConvertTo-Json @($Tracker.GetSuccessfulCommands())
$TeamsUnSuccessfulCommands = ConvertTo-Json @($Tracker.GetUnSuccessfulCommands())
Expand All @@ -30,6 +81,7 @@ function Export-TeamsProvider {
"client_configuration": $ClientConfig,
"app_policies": $AppPolicies,
"broadcast_policies": $BroadcastPolicies,
"tenant_app_settings": $TenantAppSettings,
"teams_successful_commands": $TeamsSuccessfulCommands,
"teams_unsuccessful_commands": $TeamsUnSuccessfulCommands,
"@
Expand Down
Loading
Loading