Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure.Storage v 3.0.0 - New-AzureStorageContext: InvalidOperationException using storage account name and key #3939

Closed
markcowl opened this issue May 10, 2017 · 1 comment

Comments

@markcowl
Copy link
Member

markcowl commented May 10, 2017

Description

When executing New-AzureStorageContext -StorageAccountName <name> -StorageAccountKey <key>

If the user is unauthenticated, the cmdlet will throw an InvalidOperationException like the following:

New-AzureStorageContext : "There is no current context, please log in using Login-AzureRmAccount for Azure Resource Manager or Add-AzureAccount for Azure Service Management."
At line:1 char:9
+ New-AzureStorageContext -StorageAccountName <name> -Sto ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzureStorageContext], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet.NewAzureStorageContext 

You can work around this issue using one of these two methods:

  • Add -Endpoint ".core.windows.net" to the cmdlet invocation:
  New-AzureStorageContext -StorageAccountName <name> -StorageAccountKey <key> -Endpoint ".core.windows.net"
  • log in to the session as directed by the error, using Add-AzureRmAccount or Add-AzureAccount

The cmdlet should use the default storage endpoint when no endpoint is provided in offline scenarios. This will be fixed in an upcoming hotfix.

@markcowl
Copy link
Member Author

Fixed and releases in 4.0.1 on 5/12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants