@@ -27,14 +27,23 @@ function New-AzureRmStorageAccount
27
27
[string ] [Parameter (Position = 0 , ValueFromPipelineByPropertyName = $true )] $ResourceGroupName ,
28
28
[string ] [Parameter (Position = 1 , ValueFromPipelineByPropertyName = $true )][alias (" StorageAccountName" )] $Name ,
29
29
[string ] [Parameter (Position = 2 , ValueFromPipelineByPropertyName = $true )] $Location ,
30
- [string ] [Parameter (Position = 3 , ValueFromPipelineByPropertyName = $true )] $Type )
30
+ [string ] [Parameter (Position = 3 , ValueFromPipelineByPropertyName = $true )] $typeString )
31
31
BEGIN {
32
32
$context = Get-Context
33
33
$client = Get-StorageClient $context
34
34
}
35
35
PROCESS {
36
36
$createParms = New-Object - Type Microsoft.Azure.Management.Storage.Models.StorageAccountCreateParameters
37
- $createParms.AccountType = [Microsoft.Azure.Management.Storage.Models.AccountType ]::StandardLRS
37
+ if ($typeString -eq $null )
38
+ {
39
+ $Type = [Microsoft.Azure.Management.Storage.Models.AccountType ]::StandardLRS
40
+ }
41
+ else
42
+ {
43
+ $Type = Parse- Type $typeString
44
+ }
45
+
46
+ $createParms.AccountType = $Type
38
47
$createParms.Location = $Location
39
48
$getTask = $client.StorageAccounts.CreateAsync ($ResourceGroupName , $name , $createParms , [System.Threading.CancellationToken ]::None)
40
49
$sa = $getTask.Result
@@ -43,6 +52,28 @@ function New-AzureRmStorageAccount
43
52
44
53
}
45
54
55
+ function Set-AzureRmStorageAccount
56
+ {
57
+ [CmdletBinding ()]
58
+ param (
59
+ [string ] [Parameter (Position = 0 , ValueFromPipelineByPropertyName = $true )] $ResourceGroupName ,
60
+ [string ] [Parameter (Position = 1 , ValueFromPipelineByPropertyName = $true )][alias (" StorageAccountName" )] $Name ,
61
+ [string ] [Parameter (Position = 2 , ValueFromPipelineByPropertyName = $true )] $Type ,
62
+ [Hashtable []] [Parameter (Position = 3 , ValueFromPipelineByPropertyName = $true )] $Tags )
63
+ BEGIN {
64
+ $context = Get-Context
65
+ $client = Get-StorageClient $context
66
+ }
67
+ PROCESS {
68
+ $createParms = New-Object - Type Microsoft.Azure.Management.Storage.Models.StorageAccountUpdateParameters
69
+ $createParms.AccountType = [Microsoft.Azure.Management.Storage.Models.AccountType ]::StandardLRS
70
+ $getTask = $client.StorageAccounts.UpdateAsync ($ResourceGroupName , $Name , $createParms , [System.Threading.CancellationToken ]::None)
71
+ $sa = $getTask.Result
72
+ }
73
+ END {}
74
+ }
75
+
76
+
46
77
function Get-AzureRmStorageAccountKey
47
78
{
48
79
[CmdletBinding ()]
@@ -91,6 +122,14 @@ function Get-Context
91
122
return $context
92
123
}
93
124
125
+ function Parse-Type
126
+ {
127
+ param ([string ] $type )
128
+ $type = $type.Replace (" _" , " " )
129
+ $returnSkuName = [System.Enum ]::Parse([Microsoft.Azure.Management.Storage.Models.AccountType ], $type )
130
+ return $returnSkuName ;
131
+ }
132
+
94
133
function Get-StorageClient
95
134
{
96
135
param ([Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext ] $context )
0 commit comments