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:dev' into dev
- Loading branch information
Showing
5 changed files
with
34 additions
and
9 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 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,9 +1,33 @@ | ||
# Input bindings are passed in via param block. | ||
param($Timer) | ||
|
||
#Switched to run for every tenant always, to make sure app permissions get applied succesfully. | ||
# Get the current universal time in the default string format. | ||
$currentUTCtime = (Get-Date).ToUniversalTime() | ||
|
||
$Table = Get-CIPPTable -TableName cpvtenants | ||
$CPVRows = Get-AzDataTableEntity @Table | ||
|
||
$Tenants = get-tenants | ||
$TenantList = $CPVRows.Tenant | ||
foreach ($Row in $Tenants ) { | ||
Write-Host "Processing tenants" | ||
Push-OutputBinding -Name Msg -Value $row.customerId | ||
} | ||
Write-Output "Processing tenants" | ||
|
||
if (!$CPVRows) { | ||
Write-Output "No list available" | ||
Push-OutputBinding -Name Msg -Value $row.customerId | ||
continue | ||
} | ||
|
||
if ($Row.customerId -notin $TenantList) { | ||
Write-Output "Not in the list: $($row.customerId)" | ||
Push-OutputBinding -Name Msg -Value $row.customerId | ||
continue | ||
|
||
} | ||
|
||
if ($CPVRows | Where-Object { $_.Tenant -eq $row.customerId } | Where-Object { $_.LastApply -EQ $null -or (Get-Date $_.LastApply).AddDays(-14) -gt $currentUTCtime }) { | ||
Write-Output "In list, Old age." | ||
Push-OutputBinding -Name Msg -Value $row.customerId | ||
continue | ||
} | ||
} |
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 +1 @@ | ||
3.8.1 | ||
3.8.2 |