Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.83k stars 325 forks source link

Requesting queue policies failed with azure-cli and Storage Account Explorer #13

Open nobiehl opened 6 years ago

nobiehl commented 6 years ago

Hi,

Currently I’m not able to list queue policies with azure cli and I’m also not able to list queue policies with the Storage Account explorer. But the policies will be created successfully.

I recognized that the storage account emulator is answering the get request different than azurite. There are some magic characters in front of the response and a zero at the end.

Storage Account Emulator 5.3.0.0 Azurite 2.6.5 Azure CLI 2.0.30 Windows 10 + WSL

1. Storage Account Emulator + azure cli

az storage queue create --name test-queue
az storage queue policy list --queue-name test-queue

RESPONSE (Fiddler):

3E
<?xml version="1.0" encoding="utf-8"?><SignedIdentifiers />
0
az storage queue policy create --name read --queue-name test-queue --permissions rp --start 2018-04-01 --expiry 2018-04-02
az storage queue policy list --queue-name test-queue

RESPONSE (Fiddler):

F7
<?xml version="1.0" encoding="utf-8"?><SignedIdentifiers><SignedIdentifier><Id>read</Id><AccessPolicy><Start>2018-04-01T00:00:00.0000000Z</Start><Expiry>2018-04-02T00:00:00.0000000Z</Expiry><Permission>rp</Permission></AccessPolicy></SignedIdentifier></SignedIdentifiers>
0

2. Azurite + azure cli

az storage queue create --name test-queue
az storage queue policy list –queue-name test-queue

RESPONSE (Fiddler):

<?xml version="1.0" encoding="utf-8"?>
<SignedIdentifiers/>
az storage queue policy create --name read --queue-name test-queue --permissions rp --start 2018-04-01 --expiry 2018-04-02
az storage queue policy list --queue-name test-queue

azure cli returns nothing. But the response from azurite looks like: RESPONSE (Fiddler):

<?xml version="1.0" encoding="utf-8"?>
<SignedIdentifiers>
    <SignedIdentifiers>
        <Id>read</Id>
        <AccessPolicy>
            <Start>2018-04-01</Start>
            <Expiry>2018-04-02</Expiry>
            <Permission>rp</Permission>
        </AccessPolicy>
    </SignedIdentifiers>
</SignedIdentifiers>

As you can see the magic characters in front of the response are not there and the trailing zero is also not available.

Another issue because of the issue above is that azure cli requests the queue policies first, if there are some policies available it merges the policies (old+new) and sends them back. But this is not possible with azurite. All policies will be overwritten by the new one.

Currently I circumventing the issue by using custom scripts for creating queues and policies but for debugging and some test environment related topics I need to use azure cli and the Storage Account Explorer.

Best nobiehl

edwin-huber commented 6 years ago

This is still on our list, but currently relatively low down in the priorities as we work on fixing all the issues in blob storage.