Skip to content

Commit 07ea15e

Browse files
author
Maddie Clayton
authored
Merge pull request #7821 from wastoresh/hdfs
[Storage] Support hdfs in PSH official build
2 parents 658a82a + 42220a6 commit 07ea15e

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

src/ResourceManager/Storage/Commands.Management.Storage.Test/ScenarioTests/StorageAccountTests.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function Test-SetAzureStorageAccount
213213
$kind = 'Storage'
214214

215215
New-AzureRmResourceGroup -Name $rgname -Location $loc;
216-
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -Kind $kind -EnableHttpsTrafficOnly $true;
216+
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -Kind $kind -EnableHttpsTrafficOnly $true -EnableHierarchicalNamespace $true;
217217

218218
Retry-IfException { $global:sto = Get-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname; }
219219
$stotype = 'StandardGRS';
@@ -222,19 +222,22 @@ function Test-SetAzureStorageAccount
222222
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
223223
Assert-AreEqual $kind $sto.Kind;
224224
Assert-AreEqual $true $sto.EnableHttpsTrafficOnly;
225+
Assert-AreEqual $true $sto.EnableHierarchicalNamespace;
225226

226227
$stos = Get-AzureRmStorageAccount -ResourceGroupName $rgname;
227228
Assert-AreEqual $stoname $stos[0].StorageAccountName;
228229
Assert-AreEqual $stotype $stos[0].Sku.Name;
229230
Assert-AreEqual $loc.ToLower().Replace(" ", "") $stos[0].Location;
230231
Assert-AreEqual $kind $sto.Kind;
231232
Assert-AreEqual $true $sto.EnableHttpsTrafficOnly;
233+
Assert-AreEqual $true $sto.EnableHierarchicalNamespace;
232234

233235
$stotype = 'Standard_LRS';
234236
# TODO: Still need to do retry for Set-, even after Get- returns it.
235237
Retry-IfException { Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Type $stotype -EnableHttpsTrafficOnly $false }
236238
$stotype = 'Standard_RAGRS';
237-
Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Type $stotype;
239+
$sto = Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Type $stotype;
240+
Assert-AreEqual $true $sto.EnableHierarchicalNamespace;
238241

239242
$sto = Get-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname;
240243
$stotype = 'StandardRAGRS';
@@ -243,6 +246,7 @@ function Test-SetAzureStorageAccount
243246
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
244247
Assert-AreEqual $kind $sto.Kind;
245248
Assert-AreEqual $false $sto.EnableHttpsTrafficOnly;
249+
Assert-AreEqual $true $sto.EnableHierarchicalNamespace;
246250

247251
Remove-AzureRmStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
248252
}

src/ResourceManager/Storage/Commands.Management.Storage/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
,<!--
1+
<!--
22
Please leave this section at the top of the change log.
33
44
Changes for the current release should go under the section titled "Current Release", and should adhere to the following format:
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Add -EnableHierarchicalNamespace to New-AzureRmStorageAccount
2122

2223
## Version 5.2.0
2324
* Support get the Storage resource usage of a specific location, and add warning message for get global Storage resource usage is obsolete.

src/ResourceManager/Storage/Commands.Management.Storage/Models/PSStorageAccount.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public PSStorageAccount(StorageModels.StorageAccount storageAccount)
5151
this.Tags = storageAccount.Tags;
5252
this.EnableHttpsTrafficOnly = storageAccount.EnableHttpsTrafficOnly;
5353
this.NetworkRuleSet = PSNetworkRuleSet.ParsePSNetworkRule(storageAccount.NetworkRuleSet);
54+
this.EnableHierarchicalNamespace = storageAccount.IsHnsEnabled;
5455
}
5556

5657
[Ps1Xml(Label = "ResourceGroupName", Target = ViewControl.Table, Position = 1)]
@@ -102,6 +103,8 @@ public PSStorageAccount(StorageModels.StorageAccount storageAccount)
102103

103104
[Ps1Xml(Label = "EnableHttpsTrafficOnly", Target = ViewControl.Table, Position = 8)]
104105
public bool? EnableHttpsTrafficOnly { get; set; }
106+
107+
public bool? EnableHierarchicalNamespace { get; set; }
105108

106109
public PSNetworkRuleSet NetworkRuleSet { get; set; }
107110

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/NewAzureStorageAccount.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ public PSNetworkRuleSet NetworkRuleSet
134134
get; set;
135135
}
136136

137+
[Parameter(
138+
Mandatory = false,
139+
HelpMessage = "Enable HierarchicalNamespace for the Storage account.")]
140+
[ValidateNotNullOrEmpty]
141+
public bool EnableHierarchicalNamespace
142+
{
143+
get
144+
{
145+
return enableHierarchicalNamespace.Value;
146+
}
147+
set
148+
{
149+
enableHierarchicalNamespace = value;
150+
}
151+
}
152+
private bool? enableHierarchicalNamespace = null;
153+
137154
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
138155
public SwitchParameter AsJob { get; set; }
139156

@@ -189,6 +206,10 @@ public override void ExecuteCmdlet()
189206
{
190207
createParameters.NetworkRuleSet = PSNetworkRuleSet.ParseStorageNetworkRule(NetworkRuleSet);
191208
}
209+
if (enableHierarchicalNamespace != null)
210+
{
211+
createParameters.IsHnsEnabled = enableHierarchicalNamespace;
212+
}
192213

193214
var createAccountResponse = this.StorageClient.StorageAccounts.Create(
194215
this.ResourceGroupName,

src/ResourceManager/Storage/Commands.Management.Storage/help/New-AzureRmStorageAccount.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Creates a Storage account.
1717
New-AzureRmStorageAccount [-ResourceGroupName] <String> [-Name] <String> [-SkuName] <String>
1818
[-Location] <String> [-Kind <String>] [-AccessTier <String>] [-CustomDomainName <String>]
1919
[-UseSubDomain <Boolean>] [-Tag <Hashtable>] [-EnableHttpsTrafficOnly <Boolean>] [-AssignIdentity]
20-
[-NetworkRuleSet <PSNetworkRuleSet>] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
20+
[-NetworkRuleSet <PSNetworkRuleSet>] [-EnableHierarchicalNamespace <Boolean>] [-AsJob]
21+
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2122
```
2223

2324
## DESCRIPTION
@@ -58,6 +59,13 @@ PS C:\>New-AzureRmStorageAccount -ResourceGroupName MyResourceGroup -AccountName
5859

5960
This command creates a Storage account that has NetworkRuleSet property from JSON
6061

62+
### Example 5: Create a Storage account with Hierarchical Namespace enabled.
63+
```
64+
PS C:\>New-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "mystorageaccount" -Location "US West" -SkuName "Standard_GRS" -Kind StorageV2 -EnableHierarchicalNamespace $true
65+
```
66+
67+
This command creates a Storage account with Hierarchical Namespace enabled.
68+
6169
## PARAMETERS
6270

6371
### -AccessTier
@@ -141,6 +149,21 @@ Accept pipeline input: False
141149
Accept wildcard characters: False
142150
```
143151
152+
### -EnableHierarchicalNamespace
153+
Indicates whether or not the Storage account enables Hierarchical Namespace.
154+
155+
```yaml
156+
Type: Boolean
157+
Parameter Sets: (All)
158+
Aliases:
159+
160+
Required: False
161+
Position: Named
162+
Default value: None
163+
Accept pipeline input: False
164+
Accept wildcard characters: False
165+
```
166+
144167
### -EnableHttpsTrafficOnly
145168
Indicates whether or not the Storage account only enables HTTPS traffic.
146169

0 commit comments

Comments
 (0)