首页 > 解决方案 > 我正在尝试在 azure cli 中创建文件共享,但它给了我错误

问题描述

我正在尝试在 Azure CLI 命令中创建文件共享:

az storage share create --account-name storeactjan --name filesharejan --account-key key1

但有以下错误:

服务器未能对请求进行身份验证。确保 Authorization 标头的值正确形成,包括签名。

错误代码:AuthenticationFailedAuthenticationFailed服务器未能对请求进行身份验证。确保 Authorization 标头的值正确形成,包括签名。RequestId:42b399c2-701a-006f-4630-1d9aad000000 时间:2020-04-28T07:39:27.0899771ZHTTP 请求“QVn0bi79ZIhaO+LS3w/VzaiI5cAMfJiVRav6RbgfbtA=”中找到的 MAC 签名与任何计算的签名都不相同。服务器使用以下字符串签名:'PUT'

标签: azurecommand-line-interfacestorageaccountfileshare

解决方案


您的 account-key 参数的格式不正确。这是根据 microsoft 文档 ( https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-create-file-share?tabs=azure-cli)。供您参考,我在 PowerShell 中使用 CLI。

1)以正确的格式检索密钥

$key1 = az storage account keys list --account-name storeactjan --query "[0].value" | tr -d '"'

2) 创建您的文件共享

az storage share create --account-name storeactjan --name filesharejan --account-key $key1

希望它会帮助你。


推荐阅读