Skip to content

Commit

Permalink
Merge branch 'KelvinTegelaar:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
BNWEIN authored May 16, 2024
2 parents 3abeb7f + 277b761 commit fa36111
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ function Push-ExecScheduledCommand {
if ($Results) {
$TableDesign = '<style>table.blueTable{border:1px solid #1C6EA4;background-color:#EEE;width:100%;text-align:left;border-collapse:collapse}table.blueTable td,table.blueTable th{border:1px solid #AAA;padding:3px 2px}table.blueTable tbody td{font-size:13px}table.blueTable tr:nth-child(even){background:#D0E4F5}table.blueTable thead{background:#1C6EA4;background:-moz-linear-gradient(top,#5592bb 0,#327cad 66%,#1C6EA4 100%);background:-webkit-linear-gradient(top,#5592bb 0,#327cad 66%,#1C6EA4 100%);background:linear-gradient(to bottom,#5592bb 0,#327cad 66%,#1C6EA4 100%);border-bottom:2px solid #444}table.blueTable thead th{font-size:15px;font-weight:700;color:#FFF;border-left:2px solid #D0E4F5}table.blueTable thead th:first-child{border-left:none}table.blueTable tfoot{font-size:14px;font-weight:700;color:#FFF;background:#D0E4F5;background:-moz-linear-gradient(top,#dcebf7 0,#d4e6f6 66%,#D0E4F5 100%);background:-webkit-linear-gradient(top,#dcebf7 0,#d4e6f6 66%,#D0E4F5 100%);background:linear-gradient(to bottom,#dcebf7 0,#d4e6f6 66%,#D0E4F5 100%);border-top:2px solid #444}table.blueTable tfoot td{font-size:14px}table.blueTable tfoot .links{text-align:right}table.blueTable tfoot .links a{display:inline-block;background:#1C6EA4;color:#FFF;padding:2px 8px;border-radius:5px}</style>'
$FinalResults = if ($results -is [array] -and $results[0] -is [string]) { $Results | ConvertTo-Html -Fragment -Property @{ l = 'Text'; e = { $_ } } } else { $Results | ConvertTo-Html -Fragment }
$HTML = $FinalResults -replace '<table>', "$TableDesign<table class=blueTable>" | Out-String
$title = "$TaskType - $($task.Name)"
$HTML = $FinalResults -replace '<table>', "This alert is for tenant $tenant. <br /><br /> $TableDesign<table class=blueTable>" | Out-String
$title = "$TaskType - $($task.Name) - $tenant"
Write-Host 'Scheduler: Sending the results to the target.'
Write-Host "The content of results is: $Results"
switch -wildcard ($task.PostExecution) {
Expand Down
8 changes: 6 additions & 2 deletions Modules/CIPPCore/Public/GraphHelper/Get-Tenants.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,14 @@ function Get-Tenants {
}
}

[PSCustomObject]@{
$obj = [PSCustomObject]@{
PartitionKey = 'Tenants'
RowKey = $_.Name
customerId = $_.Name
displayName = $LatestRelationship.displayName
relationshipEnd = $LatestRelationship.relationshipEnd
relationshipCount = $_.Count
defaultDomainName = $defaultDomainName
initialDomainName = $initialDomainName
hasAutoExtend = $AutoExtend
delegatedPrivilegeStatus = 'granularDelegatedAdminPrivileges'
domains = ''
Expand All @@ -123,6 +122,10 @@ function Get-Tenants {
RequiresRefresh = [bool]$RequiresRefresh
LastRefresh = (Get-Date).ToUniversalTime()
}
if ($Obj.defaultDomainName -eq 'Invalid' -or !$Obj.defaultDomainName) {
continue
}
Add-CIPPAzDataTableEntity @TenantsTable -Entity $obj -Force | Out-Null
}
}
$IncludedTenantsCache = [system.collections.generic.list[object]]::new()
Expand All @@ -145,6 +148,7 @@ function Get-Tenants {
RequiresRefresh = [bool]$RequiresRefresh
LastRefresh = (Get-Date).ToUniversalTime()
}) | Out-Null

}
foreach ($Tenant in $TenantList) {
if ($Tenant.defaultDomainName -eq 'Invalid' -or !$Tenant.defaultDomainName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ function Invoke-CIPPStandardOauthConsent {
$StateIsCorrect = if ($State.permissionGrantPolicyIdsAssignedToDefaultUserRole -eq 'managePermissionGrantsForSelf.cipp-consent-policy') { $true } else { $false }

If ($Settings.remediate -eq $true) {
$AllowedAppIdsForTenant = $Settings.AllowedApps -split ','
$AllowedAppIdsForTenant = $settings.AllowedApps -split ','
try {
if ($State.permissionGrantPolicyIdsAssignedToDefaultUserRole -notin @('ManagePermissionGrantsForSelf.cipp-1sent-policy')) {
if ($State.permissionGrantPolicyIdsAssignedToDefaultUserRole -notin @('managePermissionGrantsForSelf.cipp-consent-policy')) {
$Existing = (New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/permissionGrantPolicies/' -tenantid $tenant) | Where-Object -Property id -EQ 'cipp-consent-policy'
if (!$Existing) {
New-GraphPostRequest -tenantid $tenant -Uri 'https://graph.microsoft.com/beta/policies/permissionGrantPolicies' -Type POST -Body '{ "id":"cipp-consent-policy", "displayName":"Application Consent Policy", "description":"This policy controls the current application consent policies."}' -ContentType 'application/json'
Expand All @@ -27,9 +27,7 @@ function Invoke-CIPPStandardOauthConsent {
}
New-GraphPostRequest -tenantid $tenant -Uri 'https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy' -Type PATCH -Body '{"permissionGrantPolicyIdsAssignedToDefaultUserRole":["managePermissionGrantsForSelf.cipp-consent-policy"]}' -ContentType 'application/json'
}
if ($AllowedAppIdsForTenant) {
}


Write-LogMessage -API 'Standards' -tenant $tenant -message 'Application Consent Mode has been enabled.' -sev Info
} catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.7.0
5.7.1

0 comments on commit fa36111

Please sign in to comment.