DEV Community

Wallism
Wallism

Posted on

Azure Az.Storage command returns "A task was canceled."

Using az.storage version 6.1.0 with this command:

$context = New-AzStorageContext -StorageAccountName accountname
Enter fullscreen mode Exit fullscreen mode

(run after successfully connecting - Connect-AzAccount - and selecting the correct subscription - Set-AzAccount)

I kept getting this error:

New-AzStorageContext: A task was canceled.

Not the most helpful error message! Turns out the fix is very simple, we now need to provide the key as well (the previous version I was running did not require the key)

$context = New-AzStorageContext -StorageAccountName accountname -StorageAccountKey accountkey
Enter fullscreen mode Exit fullscreen mode

Easy...made difficult by the useless error message.

Top comments (0)