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 branch 'KelvinTegelaar:master' into master
- Loading branch information
Showing
249 changed files
with
4,340 additions
and
1,775 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
||
name: Build and deploy Powershell project to Azure Function App - cippeln4y | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
workflow_dispatch: | ||
|
||
env: | ||
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root | ||
|
||
jobs: | ||
deploy: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Run Azure Functions Action' | ||
uses: Azure/functions-action@v1 | ||
id: fa | ||
with: | ||
app-name: 'cippeln4y' | ||
slot-name: 'Production' | ||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_B82C66E0F3BD4BDD9FFFB32FA83A68C9 }} |
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
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": {} | ||
} | ||
] | ||
} |
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
Binary file added
BIN
+14.5 KB
...les/AzureFunctions.PowerShell.Durable.SDK/1.1.0/AzureFunctions.PowerShell.Durable.SDK.dll
Binary file not shown.
Binary file added
BIN
+17.8 KB
...les/AzureFunctions.PowerShell.Durable.SDK/1.1.0/AzureFunctions.PowerShell.Durable.SDK.pdb
Binary file not shown.
97 changes: 97 additions & 0 deletions
97
...es/AzureFunctions.PowerShell.Durable.SDK/1.1.0/AzureFunctions.PowerShell.Durable.SDK.psd1
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,97 @@ | ||
@{ | ||
# Version number of this module. | ||
ModuleVersion = '1.1.0' | ||
|
||
# Supported PSEditions | ||
CompatiblePSEditions = @('Core') | ||
|
||
# ID used to uniquely identify this module | ||
GUID = '841fad61-94f5-4330-89be-613d54165289' | ||
|
||
# Author of this module | ||
Author = 'Microsoft Corporation' | ||
|
||
# Company or vendor of this module | ||
CompanyName = 'Microsoft Corporation' | ||
|
||
# Copyright statement for this module | ||
Copyright = '(c) Microsoft Corporation. All rights reserved.' | ||
|
||
# Description of the functionality provided by this module | ||
Description = 'Initial release of the Durable Functions SDK for PowerShell. This package is to be used exclusively with the Azure Functions PowerShell worker.' | ||
|
||
# Minimum version of the PowerShell engine required by this module | ||
PowerShellVersion = '7.2' | ||
|
||
# Type files (.ps1xml) to be loaded when importing this module | ||
# TypesToProcess = @() # TODO: use this for pretty-printing DF tasks | ||
|
||
# Format files (.ps1xml) to be loaded when importing this module | ||
# FormatsToProcess = @() # TODO: use this for pretty-printing DF tasks | ||
|
||
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess | ||
NestedModules = @('./AzureFunctions.PowerShell.Durable.SDK.dll', './AzureFunctions.PowerShell.Durable.SDK.psm1') | ||
|
||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. | ||
FunctionsToExport = @( | ||
'Get-DurableStatus', | ||
'New-DurableOrchestrationCheckStatusResponse', | ||
'Send-DurableExternalEvent', | ||
'Start-DurableOrchestration', | ||
'Stop-DurableOrchestration', | ||
'Suspend-DurableOrchestration', | ||
'Resume-DurableOrchestration' | ||
) | ||
|
||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. | ||
CmdletsToExport = @( | ||
'Invoke-DurableActivity', | ||
'Invoke-DurableSubOrchestrator', | ||
'New-DurableRetryPolicy', | ||
'Set-DurableCustomStatus', | ||
'Set-FunctionInvocationContext', | ||
'Start-DurableExternalEventListener' | ||
'Start-DurableTimer', | ||
'Stop-DurableTimerTask', | ||
'Wait-DurableTask', | ||
'Get-DurableTaskResult' | ||
) | ||
|
||
# Variables to export from this module | ||
VariablesToExport = '*' | ||
|
||
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. | ||
AliasesToExport = @( | ||
'Invoke-ActivityFunction', | ||
'New-OrchestrationCheckStatusResponse', | ||
'Start-NewOrchestration', | ||
'Wait-ActivityFunction', | ||
'New-DurableRetryOptions' | ||
) | ||
|
||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
PrivateData = @{ | ||
|
||
PSData = @{ | ||
|
||
# Tags applied to this module. These help with module discovery in online galleries. | ||
Tags = @('Microsoft', 'Azure', 'Functions', 'Serverless', 'Cloud', 'Workflows', 'Durable', 'DurableTask') | ||
|
||
# A URL to the license for this module. | ||
LicenseUri = 'https://github.com/Azure/azure-functions-durable-powershell/blob/main/LICENSE' | ||
|
||
# A URL to the main website for this project. | ||
ProjectUri = 'https://github.com/Azure/azure-functions-durable-powershell' | ||
|
||
# ReleaseNotes of this module | ||
# ReleaseNotes = '' #TODO: add release notes. | ||
|
||
# Prerelease string of this module | ||
#Prerelease = 'alpha' | ||
|
||
} # End of PSData hashtable | ||
} # End of PrivateData hashtable | ||
|
||
# HelpInfo URI of this module | ||
# HelpInfoURI = '' # TODO: explore | ||
} |
Oops, something went wrong.