gpt4 book ai didi

Azure Blob 存储 - sp 是必需的。不能为空

转载 作者:行者123 更新时间:2023-12-03 05:24:04 26 4
gpt4 key购买 nike

我在尝试使用 SAS 链接将文件上传到 Azure Blob 存储时遇到错误。它是一个身份验证错误,提示 sp 属性为空。奇怪的是 Sp 元素出现在 SAS Url 中。

这不可能是权限问题,因为我可以使用 ADF 使用相同的 SAS URL 上传文件。

网址

BlobEndpoint=https://####.blob.core.windows.net/####?sp=racwdl&st=2021-12-08T01:14:01Z&se=2022-02-28T09:14:01Z&spr=https&sv=2020-08-04&sr=c&sig=####

错误详细信息

Server failed to authenticate the request. Make sure the value ofAuthorization header is formed correctly including the signature.RequestId:ed57ec28-f01e-00a9-79d2-ebcfc2000000Time:2021-12-08T01:22:40.1147833Z Status: 403 (Server failed toauthenticate the request. Make sure the value of Authorization headeris formed correctly including the signature.) ErrorCode:AuthenticationFailed

Additional Information: AuthenticationErrorDetail: sp is mandatory.Cannot be empty

Content: AuthenticationFailedServerfailed to authenticate the request. Make sure the value ofAuthorization header is formed correctly including the signature.RequestId:ed57ec28-f01e-00a9-79d2-ebcfc2000000Time:2021-12-08T01:22:40.1147833Zspis mandatory. Cannot be empty

Headers: x-ms-request-id: ed57ec28-f01e-00a9-79d2-ebcfc2000000x-ms-error-code: AuthenticationFailed Content-Length: 407Content-Type: application/xml Date: Wed, 08 Dec 2021 01:22:39 GMTServer: Microsoft-HTTPAPI/2.0

代码

Stream file = new FileStream(fileToUpload, FileMode.Open);
var blobServiceClient1 = new BlobServiceClient(endpointString);
var containerRef = blobServiceClient1.GetBlobContainerClient("dropoff-commissionstatements");
var blob1 = containerRef.GetBlobClient("TDM_FINAL_102449_13092021_COMMSTMT_AR_TAL_D95337.csv");
string file_extension = Path.GetExtension(fileToUpload);
string filename_withExtension = Path.GetFileName(fileToUpload);
blob1.Upload(file);

最佳答案

请尝试将连接字符串更改为:

BlobEndpoint=https://####.blob.core.windows.net/####; SharedAccessSignature=sp=racwdl&st=2021-12-08T01:14:01Z&se=2022-02-28T09:14:01Z&spr=https&sv=2020-08-04&sr=c&sig=####

更多详情请参阅此链接:https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#create-a-connection-string-using-a-shared-access-signature .

关于Azure Blob 存储 - sp 是必需的。不能为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70268870/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com