You are not passing the -ArgumentList
parameter to New-Object
, so when attempting to instantiate the specified type it will look for a constructor that takes no parameters. The parameterless constructor of the AzureStorageContext
class is protected
, not public
, though...
protected AzureStorageContext ();
...so New-Object
will not be able to invoke it.
That same Microsoft.WindowsAzure.Storage.dll
assembly is used by the Azure.Storage
package. Upon installing that...
Install-Module -Name Azure.Storage
...you can invoke the New-AzureStorageContext
cmdlet to create AzureStorageContext
instances...
$AzStorObject = New-AzureStorageContext # Additional parameters needed
Otherwise, there is a public
constructor of the AzureStorageContext
class...
public AzureStorageContext (Microsoft.WindowsAzure.Storage.CloudStorageAccount account);
...that you could use if you pass a CloudStorageAccount
instance...
$AzStorObject = New-Object -TypeName Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext -ArgumentList $myCloudStorageAccount