Joh*_*pha 6 bash terminal azure azure-cli
我正在使用 Azurite,并希望从 bash 终端创建一个容器/上传一个 blob 等!
我尝试过像这样使用 Azure CLI::
az storage container create --account-name devstoreaccount1 --account-key Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== --name mycontainer
Run Code Online (Sandbox Code Playgroud)
但当然它不起作用并抱怨身份验证失败!顺便说一句,该示例中使用了正确的帐户密钥和名称。
我相信使用 Azure CLI 与 Azurite 对话是不可能的。
我想做的就是创建一个容器并从终端上传文件到其中。
有人知道这是否可能吗?或者我是否必须使用 Java 客户端(例如)来完成这项工作?
谢谢
根据我的测试,当我们使用 Azure CLI 的帐户密钥和帐户名创建 blob 容器时,cli 将使用https协议连接 Azurite。但是,默认情况下,Azurite 仅支持http协议。欲了解更多详情,请参阅此处

因此,我建议您使用连接字符串将 Azurite 与 Azure CLI 连接,连接字符串将告诉 Azure CLI 使用http协议。
例如
az storage container create -n test --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;"
Run Code Online (Sandbox Code Playgroud)
az storage blob upload -f D:\test.csv -c test -n test.csv --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3280 次 |
| 最近记录: |