Hi,
thanks for the script which I used in the past successfully.
Today on a Windows 11 23H2 machine I ran into this error:

Method invocation failed because [System.Net.Http.HttpResponseMessage] does not contain a method named
'GetResponseStream'.
At C:\Users\floriano\Downloads\Test-IntuneFirewallRules.ps1:1130 char:7
+ $errorResponse = $ex.Response.GetResponseStream()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MethodNotFound
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.4249
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4249
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1