Skip to content

Commit ebf8f3b

Browse files
committed
Change the -Kind in Set-AzureRMstorageAccount to -UpgradeToStorageV2
1 parent 54237bd commit ebf8f3b

File tree

3 files changed

+27
-33
lines changed

3 files changed

+27
-33
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ function Test-SetAzureStorageAccountStorageV2
642642
Assert-AreEqual $sto.Kind $kind;
643643

644644
$kind = 'StorageV2'
645-
Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Kind $kind;
645+
Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -UpgradeToStorageV2;
646646
$sto = Get-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname;
647647
Assert-AreEqual $sto.StorageAccountName $stoname;
648648
Assert-AreEqual $sto.Sku.Name $stotype;

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,8 @@ public PSNetworkRuleSet NetworkRuleSet
188188

189189
[Parameter(
190190
Mandatory = false,
191-
HelpMessage = "Storage Account Kind.")]
192-
[ValidateSet(AccountKind.StorageV2, IgnoreCase = true)]
193-
public string Kind { get; set; }
191+
HelpMessage = "Upgrade Storage Account Kind to StorageV2.")]
192+
public SwitchParameter UpgradeToStorageV2 { get; set; }
194193

195194
public override void ExecuteCmdlet()
196195
{
@@ -252,9 +251,9 @@ public override void ExecuteCmdlet()
252251
updateParameters.NetworkRuleSet = PSNetworkRuleSet.ParseStorageNetworkRule(NetworkRuleSet);
253252
}
254253

255-
if (Kind != null)
254+
if (UpgradeToStorageV2.IsPresent)
256255
{
257-
updateParameters.Kind = ParseAccountKind(Kind);
256+
updateParameters.Kind = Kind.StorageV2;
258257
}
259258

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

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

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
external help file: Microsoft.Azure.Commands.Management.Storage.dll-Help.xml
3-
Module Name: AzureRM
3+
Module Name: AzureRM.Storage
44
ms.assetid: 4D7EEDD7-89D4-4B1E-A9A1-B301E759CE72
55
online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.storage/set-azurermstorageaccount
66
schema: 2.0.0
@@ -20,8 +20,8 @@ Set-AzureRmStorageAccount [-ResourceGroupName] <String> [-Name] <String> [-Force
2020
[-EnableEncryptionService <EncryptionSupportServiceEnum>]
2121
[-DisableEncryptionService <EncryptionSupportServiceEnum>] [-Tag <Hashtable>]
2222
[-EnableHttpsTrafficOnly <Boolean>] [-StorageEncryption] [-AssignIdentity]
23-
[-NetworkRuleSet <PSNetworkRuleSet>] [-Kind <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
24-
[-Confirm] [<CommonParameters>]
23+
[-NetworkRuleSet <PSNetworkRuleSet>] [-UpgradeToStorageV2] [-DefaultProfile <IAzureContextContainer>]
24+
[-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

2727
### KeyvaultEncryption
@@ -31,7 +31,7 @@ Set-AzureRmStorageAccount [-ResourceGroupName] <String> [-Name] <String> [-Force
3131
[-EnableEncryptionService <EncryptionSupportServiceEnum>]
3232
[-DisableEncryptionService <EncryptionSupportServiceEnum>] [-Tag <Hashtable>]
3333
[-EnableHttpsTrafficOnly <Boolean>] [-KeyvaultEncryption] -KeyName <String> -KeyVersion <String>
34-
-KeyVaultUri <String> [-AssignIdentity] [-NetworkRuleSet <PSNetworkRuleSet>] [-Kind <String>]
34+
-KeyVaultUri <String> [-AssignIdentity] [-NetworkRuleSet <PSNetworkRuleSet>] [-UpgradeToStorageV2]
3535
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3636
```
3737

@@ -119,7 +119,7 @@ This first command gets NetworkRuleSet property from a Storage Account, and the
119119

120120
### Example 9: Upgrade a Storage account with Kind "Storage" or "BlobStorage" to "StorageV2" kind Storage account
121121
```
122-
PS C:\> Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -Kind StorageV2
122+
PS C:\> Set-AzureRmStorageAccount -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -UpgradeToStorageV2
123123
```
124124

125125
The command upgrade a Storage account with Kind "Storage" or "BlobStorage" to "StorageV2" kind Storage account.
@@ -133,9 +133,8 @@ The acceptable values for this parameter are: Hot and Cool.
133133
If you change the access tier, it may result in additional charges. For more information, see
134134
[Azure Blob Storage: Hot and cool storage tiers](http://go.microsoft.com/fwlink/?LinkId=786482).
135135

136-
If you specify a value of BlobStorage for the *Kind* parameter of the New-AzureRmStorageAccount
137-
cmdlet, you must specify a value for the *AccessTier* parameter. If you specify a value of Storage
138-
for this *Kind* parameter, do not specify the *AccessTier* parameter.
136+
If the Storage account has Kind as StorageV2 or BlobStorage, you can specify the *AccessTier* parameter.
137+
If the Storage account has Kind as Storage, do not specify the *AccessTier* parameter.
139138

140139
```yaml
141140
Type: String
@@ -320,25 +319,6 @@ Accept pipeline input: False
320319
Accept wildcard characters: False
321320
```
322321
323-
### -Kind
324-
Specifies StorageV2 for this *Kind* paramter to upgrade Storage or BlobStorage Kind Storage Account to StorageV2 Kind Storage account.
325-
The acceptable values for this parameter is:
326-
327-
- StorageV2. General Purpose Version 2 (GPv2) storage account that supports Blobs, Tables, Queues, Files, and Disks, with advanced features like data tiering.
328-
329-
```yaml
330-
Type: String
331-
Parameter Sets: (All)
332-
Aliases:
333-
Accepted values: StorageV2
334-
335-
Required: False
336-
Position: Named
337-
Default value: None
338-
Accept pipeline input: False
339-
Accept wildcard characters: False
340-
```
341-
342322
### -Name
343323
Specifies the name of the Storage account to Modify.
344324
@@ -442,6 +422,21 @@ Accept pipeline input: True (ByPropertyName)
442422
Accept wildcard characters: False
443423
```
444424
425+
### -UpgradeToStorageV2
426+
Upgrade Storage account Kind from Storage or BlobStorage to StorageV2.
427+
428+
```yaml
429+
Type: SwitchParameter
430+
Parameter Sets: (All)
431+
Aliases:
432+
433+
Required: False
434+
Position: Named
435+
Default value: None
436+
Accept pipeline input: False
437+
Accept wildcard characters: False
438+
```
439+
445440
### -UseSubDomain
446441
Indicates whether to enable indirect CName validation.
447442

0 commit comments

Comments
 (0)