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

wallism

Wallism

Posted on January 10, 2024

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.

💖 💪 🙅 🚩
wallism
Wallism

Posted on January 10, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024

Modern C++ for LeetCode 🧑‍💻🚀
leetcode Modern C++ for LeetCode 🧑‍💻🚀

November 29, 2024