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
123 changed files
with
1,210 additions
and
1,088 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 - cippckdtz | ||
|
||
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: 'cippckdtz' | ||
slot-name: 'Production' | ||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_2101C7175BFB47E58240ABD1E72E81C2 }} |
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
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,44 +1,40 @@ | ||
param($Context) | ||
|
||
try { | ||
try { | ||
|
||
$DurableRetryOptions = @{ | ||
FirstRetryInterval = (New-TimeSpan -Seconds 5) | ||
MaxNumberOfAttempts = 3 | ||
BackoffCoefficient = 2 | ||
} | ||
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions | ||
$DurableRetryOptions = @{ | ||
FirstRetryInterval = (New-TimeSpan -Seconds 5) | ||
MaxNumberOfAttempts = 1 | ||
BackoffCoefficient = 2 | ||
} | ||
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions | ||
|
||
# Sync tenants | ||
try { | ||
Invoke-ActivityFunction -FunctionName 'DomainAnalyser_GetTenantDomains' -Input 'Tenants' | ||
} | ||
catch { Write-Host "EXCEPTION: TenantDomains $($_.Exception.Message)" } | ||
# Sync tenants | ||
try { | ||
Invoke-ActivityFunction -FunctionName 'DomainAnalyser_GetTenantDomains' -Input 'Tenants' | ||
} catch { Write-Host "EXCEPTION: TenantDomains $($_.Exception.Message)" } | ||
|
||
# Get list of all domains to process | ||
$Batch = Invoke-ActivityFunction -FunctionName 'Activity_GetAllTableRows' -Input 'Domains' | ||
|
||
$ParallelTasks = foreach ($Item in $Batch) { | ||
Invoke-DurableActivity -FunctionName 'DomainAnalyser_All' -Input $item -NoWait -RetryOptions $RetryOptions | ||
} | ||
|
||
# Collect activity function results and send to database | ||
$TableParams = Get-CippTable -tablename 'Domains' | ||
$TableParams.Entity = Wait-ActivityFunction -Task $ParallelTasks | ||
$TableParams.Force = $true | ||
$TableParams = $TableParams | ConvertTo-Json -Compress | ||
# Get list of all domains to process | ||
$Batch = Invoke-ActivityFunction -FunctionName 'Activity_GetAllTableRows' -Input 'Domains' | ||
|
||
try { | ||
Invoke-ActivityFunction -FunctionName 'Activity_AddOrUpdateTableRows' -Input $TableParams | ||
} | ||
catch { | ||
Write-Host "Orchestrator exception UpdateDomains $($_.Exception.Message)" | ||
} | ||
} | ||
catch { | ||
Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser Orchestrator Error $($_.Exception.Message)" -sev info | ||
#Write-Host $_.Exception | ConvertTo-Json | ||
} | ||
finally { | ||
Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser has Finished' -sev Info | ||
$ParallelTasks = foreach ($Item in $Batch) { | ||
Invoke-DurableActivity -FunctionName 'DomainAnalyser_All' -Input $item -NoWait -RetryOptions $RetryOptions | ||
} | ||
|
||
# Collect activity function results and send to database | ||
$TableParams = Get-CippTable -tablename 'Domains' | ||
$TableParams.Entity = Wait-ActivityFunction -Task $ParallelTasks | ||
$TableParams.Force = $true | ||
$TableParams = $TableParams | ConvertTo-Json -Compress | ||
|
||
try { | ||
Invoke-ActivityFunction -FunctionName 'Activity_AddOrUpdateTableRows' -Input $TableParams | ||
} catch { | ||
Write-Host "Orchestrator exception UpdateDomains $($_.Exception.Message)" | ||
} | ||
} catch { | ||
Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser Orchestrator Error $($_.Exception.Message)" -sev info | ||
#Write-Host $_.Exception | ConvertTo-Json | ||
} finally { | ||
Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser has Finished' -sev Info | ||
} |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.