Home > database >  Laravel 9 Azure Storage Blob Server AuthorizationPermissionMismatch
Laravel 9 Azure Storage Blob Server AuthorizationPermissionMismatch

Time:06-26

im doing an Laravel 9 project, where i store image on azure accout. I use this library https://github.com/matthewbdaly/laravel-azure-storage.

I try to connect with SAS Token it works but i got AuthorizationPermissionMismatch when i try to read it :

Route::get('/azure-test', function() {
$path = '';

$disk = \Storage::disk('azure');

$files = $disk->files($path);

dump($files);exit;
}

My configuration :

 'driver'    => 'azure',
         'driver'    => 'azure',
        'sasToken'  => env('AZURE_STORAGE_SAS_TOKEN'),
        'container' => env('AZURE_STORAGE_CONTAINER'),
        'url'       => env('AZURE_STORAGE_URL'),
        'prefix'    => null,
        'endpoint'  => env('AZURE_STORAGE_ENDPOINT'),
        'retry'     => [
            'tries' => 3,
            'interval' => 500,
            'increase' => 'exponential'
        ],

Just to be clear the file exist, i test it without SAS token configuration it display informations about my test file. I already searched and did some change, like assigned my account to roles "Storage Blob Data Contributor” and “Storage Queue Data Contributor", my sas token still work when i try to see my file "https://xxxxxxxx.blob.core.windows.net/container_name/im_test_file.pdf?sp=r&st=2022-06-24T15:32:22Z&se=2024-04-30T23:32:22Z&sv=2021-06-08&sr=c&sig=QSz6SZ6UrSMg0jqyKEr4bnnGqrMuxK2EIbGgTTbP/10=" it works.

Any Idea ?

CodePudding user response:

AFAIK, To resolve "AuthorizationPermissionMismatch" error try assigning Storage Blob Data Reader role to your account like below:

enter image description here

Please note that Azure role assignments can take up to five minutes to propagate.

Check whether you have given the below permissions while creating the SAS token:

enter image description here

For more in detail, please refer below links:

Authorize access to blobs with AzCopy & Azure Active Directory | Microsoft Docs

Fixed – authorizationpermissionmismatch Azure Blob Storage – Nishant Rana's Weblog

  • Related