Skip to content

Commit

Permalink
Merge pull request #4 from KelvinTegelaar/master
Browse files Browse the repository at this point in the history
[pull] master from KelvinTegelaar:master
  • Loading branch information
pull[bot] authored Oct 15, 2023
2 parents f50d148 + eaeace4 commit 767f613
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ListLogs/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using namespace System.Net
param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Info'
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'

if ($request.Query.Filter -eq 'True') {
$LogLevel = if ($Request.query.Severity) { ($Request.query.Severity).split(',') } else { 'Info', 'Warn', 'Error', 'Critical', 'Alert' }
Expand Down
11 changes: 3 additions & 8 deletions Modules/CIPPCore/Public/Set-CIPPCPVConsent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ function Set-CIPPCPVConsent {
$TenantName = $Tenant.defaultDomainName
$TenantFilter = $Tenant.customerId

try {
$DeleteOldPermissions = New-GraphpostRequest -Type DELETE -noauthcheck $true -uri "https://api.partnercenter.microsoft.com/v1/customers/$($TenantFilter)/applicationconsents/$($env:ApplicationID)" -scope "https://api.partnercenter.microsoft.com/.default" -tenantid $env:TenantID

}
catch {
"There is no existing CPV Application Consent for $($TenantName). Adding a new application."
}

try {
$AppBody = @"
{
Expand All @@ -41,6 +33,9 @@ function Set-CIPPCPVConsent {

}
catch {
$ErrorMessage = $_.Exception.Message
if ($ErrorMessage -like '*409 (Conflict)*') { return @("We've already added our Service Principal to $($TenantName)") }

Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Could not add our Service Principal to the client tenant $($TenantName): $($_.Exception.message)" -Sev "Error" -tenant $($Tenantfilter)
return @("Could not add our Service Principal to the client tenant $($TenantName): $($_.Exception.message)")
}
Expand Down
2 changes: 1 addition & 1 deletion Modules/CippExtensions/Private/Get-HaloToken.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function Get-HaloToken {
client_secret = (Get-AzKeyVaultSecret -VaultName $ENV:WEBSITE_DEPLOYMENT_ID -Name 'HaloPSA' -AsPlainText)
scope = 'all'
}
if (!([string]::IsNullOrEmpty($Configuration.Tenant))) { $Tenant = "?tenant=$($Configuration.tenant)" }
if ($Configuration.Tenant -ne "None") { $Tenant = "?tenant=$($Configuration.tenant)" }
$token = Invoke-RestMethod -Uri "$($Configuration.AuthURL)/token$Tenant" -Method Post -Body $body -ContentType 'application/x-www-form-urlencoded'
return $token
}
Expand Down
4 changes: 2 additions & 2 deletions Scheduler_CIPPNotifications/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ try {
}
"@
New-GraphPostRequest -uri 'https://graph.microsoft.com/v1.0/me/sendMail' -tenantid $env:TenantID -type POST -body ($JSONBody)
Write-LogMessage -API 'Alerts' -message "Sent alerts to: $($Config.email)" -tenant $Tenant -sev info
Write-LogMessage -API 'Alerts' -message "Sent alerts to: $($JSONRecipients)" -tenant $Tenant -sev info
}
}
}
Expand Down Expand Up @@ -121,7 +121,7 @@ try {
Invoke-RestMethod -Uri $config.webhook -Method POST -ContentType 'Application/json' -Body $JSONBody
}
}
Write-LogMessage -API 'Alerts' -tenant $Tenant -message "Sent Webhook to $($config.webhook) " -tenant $Tenant -sev info
Write-LogMessage -API 'Alerts' -tenant $Tenant -message "Sent Webhook to $($config.webhook)" -sev Debug
}

$UpdateLogs = $CurrentLog | ForEach-Object {
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.2
4.4.4

0 comments on commit 767f613

Please sign in to comment.