Hi @eishi,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
You want to manage Azure resources in Azure Function, but it is not advisable to directly use 'az' cli commands within a function due to security limitations. We can try alternate secure and effective approaches if you can consider.
- We can use ARM templates. We can define the deployment or deletion logic for your route in an ARM template (JSON file) and use the Azure Functions SDK or Azure PowerShell cmdlets within your function code to deploy or delete the ARM template.
- Leverage the Azure Resource Manager APIs (REST or SDK) directly from your function code to perform resource management actions. If you find this answer helpful, please click "Comment" and kindly upvote it.