本文介绍了如何使用本地 Azure Cli 安装运行 Azure Cli 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

First off I feel crazy asking this, sorry if this is a really stupid question. It must be obvious as I have searched everywhere and cannot find an answer!

我应该如何运行此 Azure 脚本来创建 Azure Function App?https://docs.microsoft.com/zh-CN/azure/azure-functions/scripts/functions-cli-create-serverless

How I am supposed to run this Azure script to create an Azure Function App?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

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

The page gives an example of how to run it using the console in the portal and the page also suggests I can run it locally if install the Azure CLI which I have. I need to run it from my local machine so that it can be automated with parameters.

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

However this page tells me nothing.

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

What should the extension of this file be ? .sh?What command do I use to call the script from my cli?

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

I have tried just typing the file name saved as .sh

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

e.g I have az --help and I can't see anything there either.

推荐答案

我刚刚在我的 Mac 上测试了这个.

I just tested this on my Mac.

将脚本复制到扩展名为 .sh 的文件中.我使用了 test.sh.

Copy the script into a file with the .sh extension. I used test.sh.

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

Make sure you are logged into your local instance of Azure CLI.

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

这篇关于如何使用本地 Azure Cli 安装运行 Azure Cli 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 17:33