Hi Charles,
Just a small remark;
I have tested your script on a test gateway with a direct internet connection which worked fine.
While implementing the solution on a production setup behind a proxy I noticed that the script did not worked.
After a quick review I noticed that your curl command is missing the output parameter:
oipaddresses=`curl_cli -k -s --cacert $CPDIR/conf/ca-bundle.crt --retry 10 --retry-delay 60 $url --proxy $HTTPS_PROXY `
This should be changed to:
oipaddresses=`curl_cli -k -s --cacert $CPDIR/conf/ca-bundle.crt --retry 10 --retry-delay 60 $url --proxy $HTTPS_PROXY -o /var/tmp/O365IPAddresses.json `
Once changed the script also works when the gateway is behind a proxy 🙂