For that you have to do some adjustments on the CMake, plus you have to pull in libraries to provide (at least) TLS and network stack. Not very straightforward...
If you are onto embedded systems and .NET may I suggest that you take a look at .NET nanoFramework ? Ready to flash images for several MCUs (from STM32 to ESP32, NXP, TI, Silabs, etc). And NuGet packages with Azure SDK.