I haven't done this, but have you considered an alternative approach - disabling the firewall post-install via netsh (so it could be scripted?) ...
Like many Linux distributions, Windows, and macOS, Ubuntu has a firewall. This security feature can prevent connections from unwanted sources on your system. Sometimes, though, you might want to ...
That's the problem. Exchange uses a range of around 2000 ports - some of which get used for other things as well. Microsoft pretty much told me "Don't do it that way. Shut off the firewall when ...