Skip to content

Commit be36db6

Browse files
authored
Merge pull request #4401 from wastoresh/networkaclnew
Rename NetworkRule to NetworkRuleSet in Set/Get/New-azureRMstorageAcc…
2 parents 5672a17 + 00972b5 commit be36db6

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,12 @@ function Test-NetworkRule
526526

527527
New-AzureRmResourceGroup -Name $rgname -Location $loc;
528528

529-
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -NetworkRule (@{bypass="Logging,Metrics,AzureServices";
529+
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -NetworkRuleSet (@{bypass="Logging,Metrics,AzureServices";
530530
ipRules=(@{IPAddressOrRange="$ip1";Action="allow"},
531531
@{IPAddressOrRange="$ip2";Action="allow"});
532532
defaultAction="Deny"})
533533

534-
$stoacl = (Get-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname).NetworkRule
534+
$stoacl = (Get-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname).NetworkRuleSet
535535
Assert-AreEqual $stoacl.Bypass 7;
536536
Assert-AreEqual $stoacl.DefaultAction Deny;
537537
Assert-AreEqual $stoacl.IpRules.Count 2
@@ -573,7 +573,7 @@ function Test-NetworkRule
573573
Assert-AreEqual $stoacl.IpRules[1].IPAddressOrRange $ip4;
574574
Assert-AreEqual $stoacl.VirtualNetworkRules $null
575575

576-
Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -NetworkRule (@{bypass="AzureServices";
576+
Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -NetworkRuleSet (@{bypass="AzureServices";
577577
ipRules=(@{IPAddressOrRange="$ip1";Action="allow"},
578578
@{IPAddressOrRange="$ip2";Action="allow"});
579579
defaultAction="Allow"})

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public PSStorageAccount(StorageModels.StorageAccount storageAccount)
4949
this.StatusOfSecondary = storageAccount.StatusOfSecondary;
5050
this.Tags = storageAccount.Tags;
5151
this.EnableHttpsTrafficOnly = storageAccount.EnableHttpsTrafficOnly;
52-
this.NetworkRule = PSNetworkRuleSet.ParsePSNetworkRule(storageAccount.NetworkAcls);
52+
this.NetworkRuleSet = PSNetworkRuleSet.ParsePSNetworkRule(storageAccount.NetworkAcls);
5353
}
5454

5555
public string ResourceGroupName { get; set; }
@@ -91,7 +91,7 @@ public PSStorageAccount(StorageModels.StorageAccount storageAccount)
9191

9292
public bool? EnableHttpsTrafficOnly { get; set; }
9393

94-
public PSNetworkRuleSet NetworkRule { get; set; }
94+
public PSNetworkRuleSet NetworkRuleSet { get; set; }
9595

9696
public static PSStorageAccount Create(StorageModels.StorageAccount storageAccount, IStorageManagementClient client)
9797
{

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public bool EnableHttpsTrafficOnly
129129
[Parameter(HelpMessage = "Storage Account NetworkRule",
130130
Mandatory = false)]
131131
[ValidateNotNullOrEmpty]
132-
public PSNetworkRuleSet NetworkRule
132+
public PSNetworkRuleSet NetworkRuleSet
133133
{
134134
get; set;
135135
}
@@ -188,9 +188,9 @@ public override void ExecuteCmdlet()
188188
{
189189
createParameters.Identity = new Identity();
190190
}
191-
if (NetworkRule != null)
191+
if (NetworkRuleSet != null)
192192
{
193-
createParameters.NetworkAcls = PSNetworkRuleSet.ParseStorageNetworkRule(NetworkRule);
193+
createParameters.NetworkAcls = PSNetworkRuleSet.ParseStorageNetworkRule(NetworkRuleSet);
194194
}
195195

196196
var createAccountResponse = this.StorageClient.StorageAccounts.Create(

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public string KeyVaultUri
181181
[Parameter(HelpMessage = "Storage Account NetworkRule",
182182
Mandatory = false)]
183183
[ValidateNotNullOrEmpty]
184-
public PSNetworkRuleSet NetworkRule
184+
public PSNetworkRuleSet NetworkRuleSet
185185
{
186186
get; set;
187187
}
@@ -241,9 +241,9 @@ public override void ExecuteCmdlet()
241241
}
242242
updateParameters.Encryption = ParseEncryption(EnableEncryptionService, DisableEncryptionService, StorageEncryption, keyvaultEncryption, KeyName, KeyVersion, KeyVaultUri);
243243
}
244-
if (NetworkRule != null)
244+
if (NetworkRuleSet != null)
245245
{
246-
updateParameters.NetworkAcls = PSNetworkRuleSet.ParseStorageNetworkRule(NetworkRule);
246+
updateParameters.NetworkAcls = PSNetworkRuleSet.ParseStorageNetworkRule(NetworkRuleSet);
247247
}
248248

249249
var updatedAccountResponse = this.StorageClient.StorageAccounts.Update(

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Creates a Storage account.
1616
New-AzureRmStorageAccount [-ResourceGroupName] <String> [-Name] <String> [-SkuName] <String>
1717
[-Location] <String> [[-Kind] <String>] [[-AccessTier] <String>] [[-CustomDomainName] <String>]
1818
[[-UseSubDomain] <Boolean>] [[-EnableEncryptionService] <EncryptionSupportServiceEnum>] [[-Tag] <Hashtable>]
19-
[-EnableHttpsTrafficOnly <Boolean>] [-AssignIdentity] [-NetworkRule <PSNetworkRuleSet>]
19+
[-EnableHttpsTrafficOnly <Boolean>] [-AssignIdentity] [-NetworkRuleSet <PSNetworkRuleSet>]
2020
[-InformationAction <ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]
2121
```
2222

@@ -48,17 +48,17 @@ PS C:\>New-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountNa
4848
This command creates a Storage account that enabled Storage Service encryption on Blob and File Services. It also generates and assigns an identity that can be used to manage
4949
account keys through Azure KeyVault.
5050

51-
### Example 4: Create a Storage Account with NetworkRule from JSON
51+
### Example 4: Create a Storage Account with NetworkRuleSet from JSON
5252
```
53-
PS C:\>New-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -Location "US West" -Type "Standard_LRS" -NetworkRule (@{bypass="Logging,Metrics";
53+
PS C:\>New-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -Location "US West" -Type "Standard_LRS" -NetworkRuleSet (@{bypass="Logging,Metrics";
5454
ipRules=(@{IPAddressOrRange="20.11.0.0/16";Action="allow"},
5555
@{IPAddressOrRange="10.0.0.0/7";Action="allow"});
5656
virtualNetworkRules=(@{VirtualNetworkResourceId="/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1";Action="allow"},
5757
@{VirtualNetworkResourceId="/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2";Action="allow"});
5858
defaultAction="Deny"})
5959
```
6060

61-
This command creates a Storage account that has NetworkRule property from JSON
61+
This command creates a Storage account that has NetworkRuleSet property from JSON
6262

6363
## PARAMETERS
6464

@@ -234,8 +234,8 @@ Accept pipeline input: True (ByPropertyName)
234234
Accept wildcard characters: False
235235
```
236236
237-
### -NetworkRule
238-
Storage Account NetworkRule
237+
### -NetworkRuleSet
238+
Storage Account NetworkRuleSet
239239
240240
```yaml
241241
Type: PSNetworkRuleSet

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Set-AzureRmStorageAccount [-ResourceGroupName] <String> [-Name] <String> [-Force
1818
[[-AccessTier] <String>] [[-CustomDomainName] <String>] [[-UseSubDomain] <Boolean>]
1919
[[-EnableEncryptionService] <EncryptionSupportServiceEnum>]
2020
[[-DisableEncryptionService] <EncryptionSupportServiceEnum>] [[-Tag] <Hashtable>]
21-
[-EnableHttpsTrafficOnly <Boolean>] [-StorageEncryption] [-AssignIdentity] [-NetworkRule <PSNetworkRuleSet>]
21+
[-EnableHttpsTrafficOnly <Boolean>] [-StorageEncryption] [-AssignIdentity] [-NetworkRuleSet <PSNetworkRuleSet>]
2222
[-InformationAction <ActionPreference>] [-InformationVariable <String>] [-WhatIf] [-Confirm]
2323
[<CommonParameters>]
2424
```
@@ -30,7 +30,7 @@ Set-AzureRmStorageAccount [-ResourceGroupName] <String> [-Name] <String> [-Force
3030
[[-EnableEncryptionService] <EncryptionSupportServiceEnum>]
3131
[[-DisableEncryptionService] <EncryptionSupportServiceEnum>] [[-Tag] <Hashtable>]
3232
[-EnableHttpsTrafficOnly <Boolean>] [-KeyvaultEncryption] -KeyName <String> -KeyVersion <String>
33-
-KeyVaultUri <String> [-AssignIdentity] [-NetworkRule <PSNetworkRuleSet>]
33+
-KeyVaultUri <String> [-AssignIdentity] [-NetworkRuleSet <PSNetworkRuleSet>]
3434
[-InformationAction <ActionPreference>] [-InformationVariable <String>] [-WhatIf] [-Confirm]
3535
[<CommonParameters>]
3636
```
@@ -97,25 +97,25 @@ PS C:\>Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountNa
9797

9898
This command disables encryption on File Services with KeySource set to "Microsoft.Storage"
9999

100-
### Example 7: Set NetworkRule property of a Storage Account with JSON
100+
### Example 7: Set NetworkRuleSet property of a Storage Account with JSON
101101
```
102-
PS C:\>Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -NetworkRule (@{bypass="Logging,Metrics";
102+
PS C:\>Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -NetworkRuleSet (@{bypass="Logging,Metrics";
103103
ipRules=(@{IPAddressOrRange="20.11.0.0/16";Action="allow"},
104104
@{IPAddressOrRange="10.0.0.0/7";Action="allow"});
105105
virtualNetworkRules=(@{VirtualNetworkResourceId="/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1";Action="allow"},
106106
@{VirtualNetworkResourceId="/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2";Action="allow"});
107107
defaultAction="allow"})
108108
```
109109

110-
This command sets NetworkRule property of a Storage Account with JSON
110+
This command sets NetworkRuleSet property of a Storage Account with JSON
111111

112-
### Example 8: Get NetworkRule property from a Storage Account, and set it to another storage account
112+
### Example 8: Get NetworkRuleSet property from a Storage Account, and set it to another storage account
113113
```
114-
PS C:\> $networkRule = (Get-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount").NetworkRule
115-
PS C:\> Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount2" -NetworkRule $networkRule
114+
PS C:\> $networkRuleSet = (Get-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount").NetworkRuleSet
115+
PS C:\> Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount2" -NetworkRuleSet $networkRuleSet
116116
```
117117

118-
This first command gets NetworkRule property from a Storage Account, and the second command sets it to another storage account
118+
This first command gets NetworkRuleSet property from a Storage Account, and the second command sets it to another Storage Account
119119

120120
## PARAMETERS
121121

@@ -349,8 +349,8 @@ Accept pipeline input: True (ByPropertyName)
349349
Accept wildcard characters: False
350350
```
351351
352-
### -NetworkRule
353-
Storage Account NetworkRule
352+
### -NetworkRuleSet
353+
Storage Account NetworkRuleSet
354354
355355
```yaml
356356
Type: PSNetworkRuleSet

0 commit comments

Comments
 (0)