如何使用本地Azure Cli安装运行Azure Cli脚本

Len*_*y D 5 azure azure-cli azure-functions

首先,我觉得这很疯狂,对不起,如果这是一个非常愚蠢的问题.它必须是明显的,因为我到处搜索,找不到答案!

我应该如何运行此Azure脚本来创建Azure功能应用程序? https://docs.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
Run Code Online (Sandbox Code Playgroud)

该页面提供了如何使用门户中的控制台运行它的示例,该页面还建议我可以在本地运行它,如果安装了我拥有的Azure CLI.我需要从我的本地机器运行它,以便它可以通过参数自动化.

但是这个页面什么也没告诉我.

该文件的扩展名应该是什么?的.sh?我用什么命令从我的cli调用脚本?

我试过只输入保存为.sh的文件名

例如,我有az --help,我也看不到任何东西.

Tra*_*ott 6

I just tested this on my Mac.

将脚本复制到带有.sh扩展名的文件中。我用过test.sh

确保您已登录到 Azure CLI 的本地实例。

然后运行: . /<path>/test.sh