New-AzureStorageContext
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
New-AzureStorageContext
Creates a storage context using storage credentials.
Parameter Set: AccountNameAndKey
New-AzureStorageContext [-StorageAccountName] <String> [-StorageAccountKey] <String> [-Endpoint <String> ] [-Protocol <String> ] [ <CommonParameters>]
Parameter Set: AccountNameAndKeyEnvironment
New-AzureStorageContext [-StorageAccountName] <String> [-StorageAccountKey] <String> [-Environment <String> ] [-Protocol <String> ] [ <CommonParameters>]
Parameter Set: AnonymousAccount
New-AzureStorageContext [-StorageAccountName] <String> -Anonymous [-Endpoint <String> ] [-Protocol <String> ] [ <CommonParameters>]
Parameter Set: AnonymousAccountEnvironment
New-AzureStorageContext [-StorageAccountName] <String> [-Environment <String> ] [-Protocol <String> ] [ <CommonParameters>]
Parameter Set: ConnectionString
New-AzureStorageContext -ConnectionString <String> [ <CommonParameters>]
Parameter Set: LocalDevelopment
New-AzureStorageContext -Local [ <CommonParameters>]
This topic describes the cmdlet in the .6.19 version of the Windows Azure PowerShell module. To find out the version of the module you're using, from the Windows Azure PowerShell console, type (get-module azure).version.
Creates a storage context object using Windows Azure storage credentials. The object can be used by other cmdlets that require storage credentials. The object contains information about how to access Windows Azure storage and about the storage endpoints to access.
-Anonymous
Specify to access the storage resources as an anonymous user. Only publicly available resources can be accessed by an anonymous user.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ConnectionString<String>
Specifies the connection string to be used when creating the storage context.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Endpoint<String>
Specifies a storage endpoint.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Environment<String>
Aliases |
Name,EnvironmentName |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Local
Specify to create a local development storage account, to be used with the storage emulator.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Protocol<String>
Specifies the transfer protocol to use, either HTTPS or HTTP.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
Https |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-StorageAccountKey<String>
Specifies the storage account key to use when creating the storage context.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-StorageAccountName<String>
Specifies the storage account name.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- AzureStorageContext
Example1
This example creates a new storage context and specifies a name and key.
C:\PS>New-AzureStorageContext -StorageAccountName name -StorageAccountKey key
Example 2
This example creates a new storage context using a connection string.
C:\PS>New-AzureStorageContext -ConnnectionString connectionstring
Example 3
This example creates a new storage context configured for anonymous access.
C:\PS>New-AzureStorageContext -StorageAccountName account -Anonymous -Protocol http
Example 4
This example creates a new storage context for use with the storage emulator.
C:\PS>New-AzureStorageContext -Local
Example 5
This example creates a new storage context and pipes the result to Get-AzureStorageContainer to get a list of containers.
C:\PS>New-AzureStorageContext -Local | Get-AzureStorageContainer
Example 6
This example creates multiple storage contexts.
C:\PS>$context1 = New-AzureStorageContext -LocalC:\PS>$context2 = new-azurestoragecontext -StorageAccountName accountname -StorageAccountKey accountkeyC:\PS>($context1, $context2) | Get-AzureStorageContainer
Example 7
This example creates a storage context with a specified storage end point.
C:\PS>New-AzureStorageContext -StorageAccountName name -StorageAccountKey key -Endpoint core.windows.net
Example 8
This example creates a storage context with a specified storage end point.
C:\PS>New-AzureStorageContext -StorageAccountName name -StorageAccountKey key -Endpoint core.chinacloudapi.cn