I cast absolutely no doubt that you can do this. Heaven knows, I still have a lot to learn about machining.
That being said--I would probably not take the step you're describing. There are a few variables that you must be aware of.
1. Gas port pressure
Full length (20"), carbine (16") long target (24"), SBR/Military (10.5, 14" and everything in between) have different sized gas ports. This has everything to do with the proper cycling and timing of the firing cycle. With this, you must be very exacting and careful.
And, if that were not enough, you have different sized gas ports for suppressed and non-suppressed firearms as well.
Too big a gas port, and you'll have a lot more gas than you need roaring back to unlock that bolt carrier group before it should. Too little and the rifle won't cycle.
And, as someone above mentioned, you must time the port to be located in a groove, and NOT on a land.
If you want to do it, and you're confident that it will work--well, then, proceed with caution. However, I would simply buy the barrel/gas block configuration that you want.
Hiding in plain sight...