Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Modules/CIPPCore/Public/Set-CIPPCPVConsent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ function Set-CIPPCPVConsent {
return @('Application is already consented to this tenant')
}

# Skip the Partner Center POST if consent was applied recently and we're not resetting
if (-not $ResetSP) {
$CpvTable = Get-CIPPTable -TableName cpvtenants
$ExistingRow = Get-CIPPAzDataTableEntity @CpvTable -Filter "PartitionKey eq 'Tenant' and RowKey eq '$TenantFilter'"
if ($ExistingRow -and $ExistingRow.applicationId -eq $env:ApplicationID -and $ExistingRow.LastApply) {
$UnixNow = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
if (($UnixNow - [int64]$ExistingRow.LastApply) -lt 86400) {
return @("CPV consent for $TenantName is current, skipping re-consent")
}
}
}

if ($ResetSP) {
try {
if ($PSCmdlet.ShouldProcess($env:ApplicationID, "Delete Service Principal from $TenantName")) {
Expand Down
Loading