我使用控制平面 API 在 Azure 文件中创建共享。 API:https://learn.microsoft.com/en-us/rest/api/storagerp/file-shares/create?view=rest-storagerp-2023-01-01&tabs=HTTP
HTTP 请求:
PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/sharename?api-version=2023-01-01 HTTP/1.1
Host: management.azure.com
Authorization: SharedKey ***:***
Accept-Encoding: gzip, deflate
Connection: close
Content-Length: 17
x-ms-date: Thu, 18 Apr 2024 09:26:55 GMT
x-ms-version: 2023-01-01
我收到一个错误: WWW-Authenticate: Bearerauthorization_uri="https://login.windows.net/***", error="invalid_token", error_description="不支持SharedKey的认证方案。"
控制API仅支持OAuth认证吗?
Control API 是否仅支持 OAuth 身份验证?
根据此MS-Document:
是的,控制 API 仅支持 OAuth2 身份验证(承载令牌)。
使用共享密钥在 Azure 文件中创建共享的 API
您可以使用以下请求使用共享密钥创建文件共享。
要求:
PUT https://venkat123.file.core.windows.net/myshare?restype=share
Request Headers:
x-ms-version: 2023-11-03
x-ms-date: Thu, 18 Apr 2024 10:24:55 GMT
Authorization: SharedKey <Your storage account name>:xxxxxMesKNh0xxxxJdjidOQ=
输出:
传送门: