userdelegationkey feature
image mcr.microsoft.com/azure-storage/azurite:3.7.0
POST to /devstoreaccount1?restype=service&comp=userdelegationkey HTTP/1.1
Exception: Azure.RequestFailedException: 'Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues RequestId:7fc4bfc5-db34-49c9-b183-a96d14c8d64a Time:2020-04-23T10:40:02.610Z Status: 500 (Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues) ErrorCode: APINotImplemented
Headers: Server: Azurite-Blob/3.7.0 x-ms-error-code: APINotImplemented x-ms-request-id: 7fc4bfc5-db34-49c9-b183-a96d14c8d64a Date: Thu, 23 Apr 2020 10:40:02 GMT Connection: keep-alive Transfer-Encoding: chunked Content-Type: application/xml
@estet Thanks for the raise the feature request! We will track this feature with other new features.
@blueww Hi We are trying to use the batchdelete function and ended up in (azurite 3.15)
Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues
RequestId:9a932926-a7b1-49aa-8c3e-4388844aa170
Time:2022-02-14T15:44:31.712Z
Status: 500 (Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues)
ErrorCode: APINotImplemented
Content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Error>
<Code>APINotImplemented</Code>
<Message>Current API is not implemented yet. Please vote your wanted features to https://github.com/azure/azurite/issues
RequestId:9a932926-a7b1-49aa-8c3e-4388844aa170
Time:2022-02-14T15:44:31.712Z</Message>
</Error>
Headers:
Server: Azurite-Blob/3.15.0
x-ms-error-code: APINotImplemented
x-ms-request-id: 9a932926-a7b1-49aa-8c3e-4388844aa170
Date: Mon, 14 Feb 2022 15:44:31 GMT
Connection: keep-alive
Keep-Alive: REDACTED
Transfer-Encoding: chunked
Content-Type: application/xml
@chatchathu199162 Delegation SAS is still not supported. It's listed in "features or REST APIs are NOT supported or limited supported" in https://github.com/Azure/Azurite#support-matrix
Azurite welcome contribution. It would be great if you can raise a PR to implement this in Azurite!
-
The get Delegation key API interface is: https://github.com/Azure/Azurite/blob/29395175764fc1feaa6ca8fac661c6fb7995def5/src/blob/handlers/ServiceHandler.ts#L62
-
The blob SAS validation logic is in: https://github.com/Azure/Azurite/blob/main/src/blob/authentication/BlobSASAuthenticator.ts
I am still not able to use the getUserDelegationKey in my Java application, I get an internal sever error. Is the feature not yet implemented?
@mynameisheisenberg This feature is still not in Azurite. We are working on it. Will update later.
The feature is already released in https://github.com/Azure/Azurite/releases/tag/v3.21.0
Can confirm that this now works, thank you :D
I am using Azurite 3.22(runned in Docker) and C# Azure Storage SDK. When I tried to get the user's delegation key, I got a 400 Bad Request response. Do I have to do some manipulation with any configuration to use the user delegation key feature? Has anyone tried getting user delegation key using C# Azure Storage SDK?
@mooweek I have it working with the C# SDK. Can you share how you are using the SDK?
@MooWeek I have it working with the C# SDK. Can you share how you are using the SDK?
Connect AzureClient
services.AddAzureClients(builder =>
{ builder.AddBlobServiceClient(new Uri(https://localhost:10000/devstoreaccount1/))
.WithCredential(credential).WithName("BlobUpload");
credential =
new DefaultAzureCredential(new DefaultAzureCredentialOptions
{
ExcludeVisualStudioCredential = true,
ExcludeVisualStudioCodeCredential = true,
ExcludeInteractiveBrowserCredential = true,
ExcludeSharedTokenCacheCredential = true
});
then trying to get UserDelegationKey
await _blobServiceClient.GetUserDelegationKeyAsync(startsOn: null, expiresOn);
Using debuggin find out that in Azure.Core.Pipeline.HttpPipeline.SendAsync()
public ValueTask SendAsync(HttpMessage message, CancellationToken cancellationToken)
{
message.CancellationToken = cancellationToken;
message.ProcessingStartTime = DateTimeOffset.UtcNow;
AddHttpMessageProperties(message);
if (message.Policies == null || message.Policies.Count == 0)
{
return _pipeline.Span[0].ProcessAsync(message, _pipeline.Slice(1));
}
return SendAsync(message);
}
condition
if (message.Policies == null || message.Policies.Count == 0) always true, and never enters SendAsync(message) and after that getting "error 400 Bad Request"
One difference I spot with my code is that you put startsOn on null can you try to change that to DateTimeOffset.UtcNow and see if it helps resolve your issue?
The Start and Expiry are required in API get-user-delegation-key: https://learn.microsoft.com/en-us/rest/api/storageservices/get-user-delegation-key#request-body
Now it works! Thank`s a lot
FWIW the java sdk docs state that a null start parameter means an immediate start: https://learn.microsoft.com/en-us/java/api/com.azure.storage.blob.blobserviceclient?view=azure-java-stable#com-azure-storage-blob-blobserviceclient-getuserdelegationkey(java-time-offsetdatetime-java-time-offsetdatetime)
However, thanks to this thread, I found that I need to set a non-null start when working with Azurite.