diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 index e885190d4ee4..4a93edabd2d7 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecCSPLicense.ps1 @@ -33,6 +33,9 @@ Function Invoke-ExecCSPLicense { if ($Action -eq 'NewSub') { $GraphRequest = Set-SherwebSubscription -tenantFilter $TenantFilter -SKU $Request.body.sku -Quantity $Request.body.Quantity } + if ($Action -eq 'Cancel') { + $GraphRequest = Remove-SherwebSubscription -tenantFilter $TenantFilter -SubscriptionIds $Request.body.SubscriptionIds + } $Message = 'License change executed successfully.' } catch { $Message = "Failed to execute license change. Error: $_"