首先,我觉得问这个问题很疯狂,如果这是一个非常愚蠢的问题,我很抱歉。这一定是显而易见的,因为我已经到处搜索但找不到答案!
我应该如何运行此 Azure 脚本来创建 Azure Function App? https://learn.microsoft.com/en-us/azure/azure-functions/scripts/functions-cli-create-serverless
#!/bin/bash
# Function app and storage account names must be unique.
storageName=mystorageaccount$RANDOM
functionAppName=myserverlessfunc$RANDOM
# Create a resource group.
az group create --name myResourceGroup --location westeurope
# Create an Azure storage account in the resource group.
az storage account create \
--name $storageName \
--location westeurope \
--resource-group myResourceGroup \
--sku Standard_LRS
# Create a serverless function app in the resource group.
az functionapp create \
--name $functionAppName \
--storage-account $storageName \
--consumption-plan-location westeurope \
--resource-group myResourceGroup
Clean up deployment
该页面提供了如何使用门户中的控制台运行它的示例,该页面还建议如果安装我拥有的 Azure CLI,我可以在本地运行它。我需要从本地计算机运行它,以便可以使用参数实现自动化。
但是这个页面什么也没告诉我。
该文件的扩展名应该是什么? .sh? 我应该使用什么命令从我的 cli 调用脚本?
我尝试只输入保存为 .sh 的文件名
例如,我有 az --help,但我也看不到任何内容。
最佳答案
我刚刚在我的 Mac 上测试了这个。
将脚本复制到带有 .sh
的文件中扩大。我用过test.sh
.
确保您已登录到 Azure CLI 的本地实例。
然后运行:
. /<path>/test.sh
关于azure - 如何使用本地 Azure Cli 安装运行 Azure Cli 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51727439/