Skip to content

Commit 32b0bdf

Browse files
committed
feat: Add warning for outdated PowerShell version in Invoke-GetCippAlerts function
1 parent 743916b commit 32b0bdf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-GetCippAlerts.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ function Invoke-GetCippAlerts {
5353
type = 'error'
5454
})
5555
}
56+
$PSMinVersion = [Version]'7.4.0'
57+
if ($PSVersionTable.PSVersion -lt $PSMinVersion) {
58+
$Alerts.Add(@{
59+
title = 'PowerShell Version Out of Date'
60+
Alert = ('Your CIPP API is running PowerShell {0}. PowerShell 7.4 or later is required for full compatibility. Please update your Function App to use PowerShell 7.4. For hosted customers, please contact the helpdesk.' -f $PSVersionTable.PSVersion)
61+
link = 'https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell#powershell-versions'
62+
type = 'warning'
63+
})
64+
Write-LogMessage -message ('CIPP API is running PowerShell {0}. PowerShell 7.4 or later is required.' -f $PSVersionTable.PSVersion) -API 'Updates' -tenant 'All Tenants' -sev Alert
65+
}
5666
if (!(![string]::IsNullOrEmpty($env:WEBSITE_RUN_FROM_PACKAGE) -or ![string]::IsNullOrEmpty($env:DEPLOYMENT_STORAGE_CONNECTION_STRING)) -and $env:AzureWebJobsStorage -ne 'UseDevelopmentStorage=true' -and $env:NonLocalHostAzurite -ne 'true') {
5767
$Alerts.Add(
5868
@{

0 commit comments

Comments
 (0)