forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
- Loading branch information
Showing
594 changed files
with
14,833 additions
and
70,779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,43 @@ | ||
using namespace System.Net | ||
|
||
param($Request, $TriggerMetadata) | ||
if ($CurrentlyRunning) { | ||
$Results = [pscustomobject]@{'Results' = 'Already running. Please wait for the current instance to finish' } | ||
Write-LogMessage -API 'BestPracticeAnalyser' -message 'Attempted to start analysis but an instance was already running.' -sev Info | ||
|
||
if ($Request.Query.TenantFilter) { | ||
$TenantList = @($Request.Query.TenantFilter) | ||
$Name = "Best Practice Analyser ($($Request.Query.TenantFilter))" | ||
} else { | ||
$InputObject = @{ | ||
TenantFilter = $Request.Query.TenantFilter | ||
$TenantList = Get-Tenants | ||
$Name = 'Best Practice Analyser (All Tenants)' | ||
} | ||
$CippRoot = (Get-Item $PSScriptRoot).Parent.FullName | ||
$TemplatesLoc = Get-ChildItem "$CippRoot\Config\*.BPATemplate.json" | ||
$Templates = $TemplatesLoc | ForEach-Object { | ||
$Template = $(Get-Content $_) | ConvertFrom-Json | ||
$Template.Name | ||
} | ||
|
||
$BPAReports = foreach ($Tenant in $TenantList) { | ||
foreach ($Template in $Templates) { | ||
[PSCustomObject]@{ | ||
FunctionName = 'BPACollectData' | ||
Tenant = $Tenant.defaultDomainName | ||
Template = $Template | ||
QueueName = '{0} - {1}' -f $Template, $Tenant.defaultDomainName | ||
} | ||
} | ||
$InstanceId = Start-NewOrchestration -FunctionName 'BestPracticeAnalyser_Orchestration' -InputObject $InputObject | ||
Write-Host "Started orchestration with ID = '$InstanceId'" | ||
$Orchestrator = New-OrchestrationCheckStatusResponse -Request $Request -InstanceId $InstanceId | ||
Write-LogMessage -API 'BestPracticeAnalyser' -message 'Started retrieving best practice information' -sev Info | ||
$Results = [pscustomobject]@{'Results' = 'Started running analysis' } | ||
} | ||
Write-Host ($Orchestrator | ConvertTo-Json) | ||
|
||
$Queue = New-CippQueueEntry -Name $Name -TotalTasks ($BPAReports | Measure-Object).Count | ||
$BPAReports = $BPAReports | Select-Object *, @{Name = 'QueueId'; Expression = { $Queue.RowKey } } | ||
$InputObject = [PSCustomObject]@{ | ||
Batch = @($BPAReports) | ||
OrchestratorName = 'BPAOrchestrator' | ||
SkipLog = $true | ||
DurableMode = 'Sequence' | ||
} | ||
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Compress -Depth 5) | ||
|
||
$Results = [pscustomobject]@{'Results' = 'BPA started' } | ||
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ | ||
StatusCode = [HttpStatusCode]::OK | ||
Body = $results | ||
Body = $Results | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,36 @@ | ||
param($Timer) | ||
|
||
if ($env:DEV_SKIP_BPA_TIMER) { | ||
if ($env:DEV_SKIP_BPA_TIMER) { | ||
Write-Host 'Skipping BPA timer' | ||
exit 0 | ||
exit 0 | ||
} | ||
|
||
try { | ||
$CurrentlyRunning = Get-Item 'Cache_BestPracticeAnalyser\CurrentlyRunning.txt' -ErrorAction SilentlyContinue | Where-Object -Property LastWriteTime -GT (Get-Date).AddHours(-24) | ||
if ($CurrentlyRunning) { | ||
$Results = [pscustomobject]@{'Results' = 'Already running. Please wait for the current instance to finish' } | ||
Write-LogMessage -API 'BestPracticeAnalyser' -message 'Attempted to start analysis but an instance was already running.' -sev Info | ||
} | ||
else { | ||
$InstanceId = Start-NewOrchestration -FunctionName 'BestPracticeAnalyser_Orchestration' | ||
Write-Host "Started orchestration with ID = '$InstanceId'" | ||
$Orchestrator = New-OrchestrationCheckStatusResponse -Request $Timer -InstanceId $InstanceId | ||
Write-LogMessage -API 'BestPracticeAnalyser' -message 'Started retrieving best practice information' -sev Info | ||
$Results = [pscustomobject]@{'Results' = 'Started running analysis' } | ||
$TenantList = Get-Tenants | ||
|
||
$CippRoot = (Get-Item $PSScriptRoot).Parent.FullName | ||
$TemplatesLoc = Get-ChildItem "$CippRoot\Config\*.BPATemplate.json" | ||
$Templates = $TemplatesLoc | ForEach-Object { | ||
$Template = $(Get-Content $_) | ConvertFrom-Json | ||
$Template.Name | ||
} | ||
|
||
$BPAReports = foreach ($Tenant in $TenantList) { | ||
foreach ($Template in $Templates) { | ||
[PSCustomObject]@{ | ||
FunctionName = 'BPACollectData' | ||
Tenant = $Tenant.defaultDomainName | ||
Template = $Template | ||
QueueName = '{0} - {1}' -f $Template, $Tenant.defaultDomainName | ||
} | ||
} | ||
Write-Host ($Orchestrator | ConvertTo-Json) | ||
} | ||
catch { Write-Host "BestPracticeAnalyser_OrchestratorStarterTimer Exception $($_.Exception.Message)" } | ||
|
||
$Queue = New-CippQueueEntry -Name 'Best Practice Analyser' -TotalTasks ($BPAReports | Measure-Object).Count | ||
$BPAReports = $BPAReports | Select-Object *, @{Name = 'QueueId'; Expression = { $Queue.RowKey } } | ||
$InputObject = [PSCustomObject]@{ | ||
Batch = @($BPAReports) | ||
OrchestratorName = 'BPAOrchestrator' | ||
SkipLog = $true | ||
DurableMode = 'Sequence' | ||
} | ||
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Compress -Depth 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"bindings": [ | ||
{ | ||
"name": "Timer", | ||
"type": "timerTrigger", | ||
"direction": "in", | ||
"schedule": "0 0 0 * * *" | ||
}, | ||
{ | ||
"name": "starter", | ||
"type": "durableClient", | ||
"direction": "in" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Input bindings are passed in via param block. | ||
param($Timer) | ||
|
||
try { | ||
$Tenants = Get-Tenants -IncludeAll | Where-Object { $_.customerId -ne $env:TenantId -and $_.Excluded -eq $false } | ||
$Tenants | ForEach-Object { | ||
Remove-CIPPGraphSubscription -cleanup $true -TenantFilter $_.defaultDomainName | ||
} | ||
} catch {} |
2 changes: 1 addition & 1 deletion
2
Config/7b41924e-3051-4a23-b0d0-8cdeadc2c05a.IntuneTemplate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"Displayname": "CIPP: Enable Onedrive Silent Logon and Known Folder Move", | ||
"Description": "This policy enables Onedrive Silent Logon and Known Folder move", | ||
"RAWJson": "{\n\"added\":[\n{\n\"enabled\":true,\n\"presentationValues\":[],\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('9a4db949-29e4-4e31-a129-bf2b88d8fa1b')\"\n},\n{\n\"enabled\":true,\n\"presentationValues\":[\n{\n\"@odata.type\":\"#microsoft.graph.groupPolicyPresentationValueText\",\n\"value\":\"%tenantid%\",\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('39147fa2-6c5e-437b-8264-19b50b891709')/presentations('fbefbbdf-5382-477c-8b6c-71f4a06e2805')\"\n},\n{\n\"@odata.type\":\"#microsoft.graph.groupPolicyPresentationValueText\",\n\"value\":\"0\",\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('39147fa2-6c5e-437b-8264-19b50b891709')/presentations('35c82072-a93b-4022-be14-8684c2f6fcc2')\"\n}\n],\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('39147fa2-6c5e-437b-8264-19b50b891709')\"\n},\n{\n\"enabled\":true,\n\"presentationValues\":[],\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('81c07ba0-7512-402d-b1f6-00856975cfab')\"\n},\n{\n\"enabled\":true,\n\"presentationValues\":[],\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('61b07a01-7e60-4127-b086-f6b32458a5c5')\"\n},\n],\n\"updated\":[],\n\"deletedIds\":[]\n}", | ||
"RAWJson": "{\r\n\"added\":[\r\n{\r\n\"enabled\":true,\r\n\"presentationValues\":[],\r\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('9a4db949-29e4-4e31-a129-bf2b88d8fa1b')\"\r\n},\r\n{\r\n\"enabled\":true,\r\n\"presentationValues\":[\r\n{\r\n\"@odata.type\":\"#microsoft.graph.groupPolicyPresentationValueText\",\r\n\"value\":\"%tenantid%\",\r\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('39147fa2-6c5e-437b-8264-19b50b891709')/presentations('fbefbbdf-5382-477c-8b6c-71f4a06e2805')\"\r\n},\r\n{\r\n\"@odata.type\":\"#microsoft.graph.groupPolicyPresentationValueText\",\r\n\"value\":\"0\",\r\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('39147fa2-6c5e-437b-8264-19b50b891709')/presentations('35c82072-a93b-4022-be14-8684c2f6fcc2')\"\r\n}\r\n],\r\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('39147fa2-6c5e-437b-8264-19b50b891709')\"\r\n},\r\n{\r\n\"enabled\":true,\r\n\"presentationValues\":[],\r\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('81c07ba0-7512-402d-b1f6-00856975cfab')\"\r\n},\r\n{\r\n\"enabled\":true,\r\n\"presentationValues\":[],\r\n\"[email protected]\":\"https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('61b07a01-7e60-4127-b086-f6b32458a5c5')\"\r\n}\r\n],\r\n\"updated\":[],\r\n\"deletedIds\":[]\r\n}", | ||
"Type": "Admin", | ||
"GUID": "7b41924e-3051-4a23-b0d0-8cdeadc2c05a.IntuneTemplate.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "CIPP Tenant Feature Licensing", | ||
"style": "Table", | ||
"Fields": [ | ||
{ | ||
"name": "AssignedPlans", | ||
"UseExistingInfo": false, | ||
"ExtractFields": ["AADPremiumService", "exchange", "SharePoint"], | ||
"FrontendFields": [ | ||
{ | ||
"name": "Entra ID Premium", | ||
"value": "AssignedPlans.AADPremiumService", | ||
"formatter": "bool" | ||
}, | ||
{ | ||
"name": "Exchange", | ||
"value": "AssignedPlans.exchange", | ||
"formatter": "bool" | ||
}, | ||
{ | ||
"name": "SharePoint", | ||
"value": "AssignedPlans.SharePoint", | ||
"formatter": "bool" | ||
} | ||
], | ||
"desc": "Entra ID Premium Status", | ||
"StoreAs": "JSON", | ||
"API": "CIPPFunction", | ||
"Command": "Get-CIPPTenantCapabilities", | ||
"Parameters": {} | ||
} | ||
] | ||
} |
Oops, something went wrong.