Run Azure CLI Commands from a Azure Function APP

拟墨画扇 提交于 2021-01-29 16:31:17

问题


I need suggestions on how to use azure function app to create Web app in Azure under a resource group. Is there any way from azure function app can i invoke an azure CLI to create a Resource.

Thanks in advance.


回答1:


Azure function does not support Azure CLI now.At present, there are several Generally available and experimental languages in Azure Function. You can use Powershell instead.

If you want to create resources using Azure functions, you can use the REST API to create resources and manage them.




回答2:


Actually, Azure CLI is an executable Python package which you can find it from its PyPI page https://pypi.org/project/azure-cli/.

So if you follow the offical tutorial Quickstart: Create an HTTP triggered Python function in Azure to create an Azure Function App for Python, you can try to install Azure CLI as a Python package via pip install azure-cli, and then refer to the other SO thread Azure Function - trigger Python script containing Azure CLI commands to invoke it with your parameters to create a resource as you want.

Of couse, it's not a recommended way to use Azure CLI. May you can make your app works in Python, but the normal solution is to use Azure Management SDK or directly call the related REST API Web Apps - Create Or Update.



来源:https://stackoverflow.com/questions/59354593/run-azure-cli-commands-from-a-azure-function-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!