1
- ---
1
+ ---
2
2
external help file : Microsoft.Azure.PowerShell.Cmdlets.Storage.dll-Help.xml
3
3
Module Name : Az.Storage
4
4
ms.assetid : 383402B2-6B7C-41AB-AFF9-36C86156B0A9
@@ -78,45 +78,45 @@ The **New-AzStorageContext** cmdlet creates an Azure Storage context.
78
78
79
79
### Example 1: Create a context by specifying a storage account name and key
80
80
```
81
- C:\PS >New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >"
81
+ PS C:\>New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >"
82
82
```
83
83
84
84
This command creates a context for the account named ContosoGeneral that uses the specified key.
85
85
86
86
### Example 2: Create a context by specifying a connection string
87
87
```
88
- C:\PS >New-AzStorageContext -ConnectionString "DefaultEndpointsProtocol=https;AccountName=ContosoGeneral;AccountKey=< Storage Key for ContosoGeneral ends with == >;"
88
+ PS C:\>New-AzStorageContext -ConnectionString "DefaultEndpointsProtocol=https;AccountName=ContosoGeneral;AccountKey=< Storage Key for ContosoGeneral ends with == >;"
89
89
```
90
90
91
91
This command creates a context based on the specified connection string for the account ContosoGeneral.
92
92
93
93
### Example 3: Create a context for an anonymous storage account
94
94
```
95
- C:\PS >New-AzStorageContext -StorageAccountName "ContosoGeneral" -Anonymous -Protocol "http"
95
+ PS C:\>New-AzStorageContext -StorageAccountName "ContosoGeneral" -Anonymous -Protocol "http"
96
96
```
97
97
98
98
This command creates a context for anonymous use for the account named ContosoGeneral.
99
99
The command specifies HTTP as a connection protocol.
100
100
101
101
### Example 4: Create a context by using the local development storage account
102
102
```
103
- C:\PS >New-AzStorageContext -Local
103
+ PS C:\>New-AzStorageContext -Local
104
104
```
105
105
106
106
This command creates a context by using the local development storage account.
107
107
The command specifies the * Local* parameter.
108
108
109
109
### Example 5: Get the container for the local developer storage account
110
110
```
111
- C:\PS >New-AzStorageContext -Local | Get-AzStorageContainer
111
+ PS C:\>New-AzStorageContext -Local | Get-AzStorageContainer
112
112
```
113
113
114
114
This command creates a context by using the local development storage account, and then passes the new context to the ** Get-AzStorageContainer** cmdlet by using the pipeline operator.
115
115
The command gets the Azure Storage container for the local developer storage account.
116
116
117
117
### Example 6: Get multiple containers
118
118
```
119
- C:\PS >$Context01 = New-AzStorageContext -Local
119
+ PS C:\>$Context01 = New-AzStorageContext -Local
120
120
PS C:\> $Context02 = New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >"
121
121
PS C:\> ($Context01, $Context02) | Get-AzStorageContainer
122
122
```
@@ -127,23 +127,23 @@ The final command gets the containers for the contexts stored in $Context01 and
127
127
128
128
### Example 7: Create a context with an endpoint
129
129
```
130
- C:\PS >New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >" -Endpoint "contosoaccount.core.windows.net"
130
+ PS C:\>New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >" -Endpoint "contosoaccount.core.windows.net"
131
131
```
132
132
133
133
This command creates an Azure Storage context that has the specified storage endpoint.
134
134
The command creates the context for the account named ContosoGeneral that uses the specified key.
135
135
136
136
### Example 8: Create a context with a specified environment
137
137
```
138
- C:\PS >New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >" -Environment "AzureChinaCloud"
138
+ PS C:\>New-AzStorageContext -StorageAccountName "ContosoGeneral" -StorageAccountKey "< Storage Key for ContosoGeneral ends with == >" -Environment "AzureChinaCloud"
139
139
```
140
140
141
141
This command creates an Azure storage context that has the specified Azure environment.
142
142
The command creates the context for the account named ContosoGeneral that uses the specified key.
143
143
144
144
### Example 9: Create a context by using an SAS token
145
145
```
146
- C:\PS >$SasToken = New-AzStorageContainerSASToken -Name "ContosoMain" -Permission "rad"
146
+ PS C:\>$SasToken = New-AzStorageContainerSASToken -Name "ContosoMain" -Permission "rad"
147
147
PS C:\> $Context = New-AzStorageContext -StorageAccountName "ContosoGeneral" -SasToken $SasToken
148
148
PS C:\> $Context | Get-AzStorageBlob -Container "ContosoMain"
149
149
```
@@ -155,8 +155,8 @@ The final command lists all the blobs associated with the container named Contos
155
155
156
156
### Example 10: Create a context by using the OAuth Authentication
157
157
```
158
- C:\PS >Connect-AzAccount
159
- C:\PS > $Context = New-AzStorageContext -StorageAccountName "myaccountname" -UseConnectedAccount
158
+ PS C:\>Connect-AzAccount
159
+ PS C:\> $Context = New-AzStorageContext -StorageAccountName "myaccountname" -UseConnectedAccount
160
160
```
161
161
162
162
This command creates a context by using the OAuth Authentication.
0 commit comments