Skip to content

Commit

Permalink
new standards
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Jan 2, 2025
1 parent 8bf58c6 commit 86db56d
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function Invoke-CIPPStandardDisableEntraPortal {
<#
.FUNCTIONALITY
Internal
.COMPONENT
(APIName) DisableEntraPortal
.SYNOPSIS
(Label) Disables the Entra Portal for standard users
https://docs.cipp.app/user-documentation/tenant/standards/edit-standards
#>

param($Tenant, $Settings)
#$Rerun -Type Standard -Tenant $Tenant -API 'allowOTPTokens' -Settings $Settings
#This standard is still unlisted due to MS fixing some permissions. This will be added to the list once it is fixed.
$CurrentInfo = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/admin/entra/uxSetting' -tenantid $Tenant

If ($Settings.remediate -eq $true) {
if ($CurrentInfo.restrictNonAdminAccess) {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Disable user access to Entra Portal is already enabled.' -sev Info
} else {
New-GraphPOSTRequest -uri 'https://graph.microsoft.com/beta/admin/entra/uxSetting' -tenantid $Tenant -body '{"restrictNonAdminAccess":true}' -type PATCH
}
}

if ($Settings.alert -eq $true) {
if ($CurrentInfo.isSoftwareOathEnabled) {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Disable user access to Entra Portal is enabled' -sev Info
} else {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Disable user access to Entra Portal is not enabled' -sev Alert
}
}

if ($Settings.report -eq $true) {
Add-CIPPBPAField -FieldName 'DisableEntraPortal' -FieldValue $CurrentInfo.isSoftwareOathEnabled -StoreAs bool -Tenant $tenant
}

}

0 comments on commit 86db56d

Please sign in to comment.