{
"method": "PUT",
"headers": {
"x-ms-version": "2021-06-08",
"x-ms-blob-type": "BlockBlob",
"x-ms-date": "Wed, 29 Jan 2025 14:37:47 GMT",
"Content-Length": "0",
"Authorization": "SharedKey {storage_account_name}:{staorage_account_access_key}"
},
"url": "https://sample.dfs.core.windows.net/test-data/csv/archive/test.done",
"body": " ",
"authentication": {
"type": "MSI",
"resource": "https://storage.azure.com/"
}
}
但是我要低于错误,根据文档,我通过了header中的所有必需值
{"error":{"code":"MissingRequiredHeader","message":"An HTTP header that's mandatory for this request is not specified.\nRequestId:swjdbjw4-ewj-sjcb-315b-cdsccdsc\nTime:2025-01-29T14:37:49.3616136Z"}}
i已转介以下文档https://learn.microsoft.com/en-us/rest/rest/api/storageservices/put-blob?tabs =microsoft-entra-Id
任何人可以帮助我解决上述问题并创建一个新的空文件。授权是系统分配的托管身份,请找到以下屏幕截图
您已经在使用系统分配的托管身份作为身份验证,因此无需使用任何携带者令牌或共享访问密钥来进行授权。这可能是您错误的原因。
您可以按照以下逐步的过程来满足您的要求。
使用ADF Web活动中的以下配置。
URL - https://<storage_account_name>.dfs.core.windows.net/<container_name><folder_and_filepath>?resource=file&x-ms-version=2018-11-09
Method - PUT
Body - {}
Authentication- System-assigned managed identity
Resource - https://storage.azure.com/
Headers:
Content-type - application/octet-stream
x-ms-date - @{formatDateTime(utcnow(),'r')}
您需要确保您已将存储BLOB数据贡献者角色分配给您的
System分配的ADLSGen2中的托管身份。您可以在下面的存储帐户中检查托管身份的访问。
现在,将在ADLS Gen2容器中创建给定文件夹中的管道和空文件,如下所示。