Thanks @liangshiwei, it works in local. But after deploying it to Azure app services, we still have to use DevOps tasks to update the app settings. We will investigate more.
Thank you, they are general but guide us to the right direction.